home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / steph1b0.zip / STEPH.DOC < prev    next >
Text File  |  1994-10-30  |  188KB  |  5,468 lines

  1. Steph
  2. Programmers Manual
  3.                            
  4.                            
  5. Windows and Menus user interface library for C.
  6. Version 1.0b.
  7. Copyright (c) 1993/1994,
  8. by Stephen Morphet
  9.                            
  10.  
  11. CONTENTS.
  12.  
  13. SHAREWARE.
  14.     What is Shareware?
  15.     Rules for Steph.
  16. INTRODUCTION.
  17.     Who is Steph?
  18.     What kind of features does Steph provide?
  19.     Why does Steph use text mode?
  20.     The Steph Libraries.
  21.     Disclaimer.
  22. STEPH APPLICATIONS - AN OVERVIEW.
  23.     What bits does an application need?
  24.     Menus.
  25.     Windows.
  26.     Dialogue boxes and variations.
  27.     The Toolbar.
  28.     The Speed Bar.
  29. WRITING STEPH APPLICATIONS.
  30.     DEMO.C,  A sample application.
  31.     Hooks.
  32.     Initialising Steph.
  33.     Menus
  34.          Building Menus.
  35.          Attaching functions to menus.
  36.          Adding help text to menus.
  37.          Checkable items.
  38.          Grey items.
  39.          Using Menus.
  40.               Keyboard.
  41.               Mouse.
  42.     Windows
  43.          Building Windows.
  44.          The keyboard and windows.
  45.               Implementing filter and action functions.
  46.               Examples:
  47.          The mouse and windows.
  48.               Notes on using the scroll bar hooks.                                      
  49.     A minimum program.
  50.     The keyboard at 'system level'.
  51.     Flash Boxes.
  52.     Building Dialogue Boxes.
  53.          Adding controls to Dialogue Boxes.
  54.               Frame:
  55.               Label:
  56.               Button:
  57.               Check box:
  58.               Radio buttons:
  59.               Text:
  60.               List:
  61.               Combo box:
  62.          Reading and writing the data in a dialogue.
  63.               Buttons:
  64.               Check boxes:
  65.               Radio buttons:
  66.               Text boxes:
  67.               List boxes:
  68.               Combo boxes:
  69.               Labels:
  70.           Frames:
  71.          Updating and redrawing controls.
  72.          Greyness.
  73.          Overriding a control's exit mode.
  74.          Dialogue box bars.
  75.          Dependency.
  76.          Dialogue box global keys.
  77.     Query Boxes.
  78.          Using Dialogue Boxes.
  79.               Mouse.
  80.               Keyboard.
  81.     More things to do with windows.
  82.          Opening, closing, resizing etc.
  83.          Redrawing and refreshing windows.
  84.          The window contents list.
  85.          Fixed lines.
  86.          Window redraw modes and the redraw function.
  87.               The WD_AUTO mode.
  88.               The WD_COLOUR mode.
  89.               The WD_CLEAR mode.
  90.               The WD_AUTO mode.
  91.               Colouring functions for WD_COLOUR mode.
  92.               Details of colour code storage in WD_COLOUR mode.
  93.     The Speed Bar.
  94.          Text display on the speed bar.
  95.          Adding buttons to the speed bar.
  96.     The Tool Bar.
  97.          Reserving a toolbar.
  98.          Controls on the speed bar.
  99.          Displaying text on the toolbar.
  100.     Pop up menus.
  101.     Other Steph Facilities.
  102.          The Initialise Function.
  103.          The Loop Functions.
  104.          Draggable dialogues.
  105.          Working with Lists.
  106.          Memory allocation details.
  107.               The mem_handler function.
  108.               Redefining mem_handler.
  109.               Using the mem_handler mechanism from application code.
  110.               A neater way to allocate memory. 
  111.     Customising Steph.
  112. USING STEPH IN GRAPHICS MODE.
  113.     Set the computer into graphics mode.
  114.     Call _steph_initialise with the M_GRAPHIC parameter.
  115.     Set up screen save and restore functions.
  116.     Call _steph_setupgraphic, giving details of
  117.        the screen size and pointers to the save and
  118.        restore functions.
  119.     Call _steph_go
  120.     Include code to restore the screen mode in your exit function.
  121.  
  122. REFERENCE.
  123.     User Functions.
  124.          Setup And Go Functions.
  125.          Window Build Functions.
  126.          Menu Build Functions.
  127.          Dialogue Box And Control Build Functions.
  128.          Miscellaneous Build Functions.
  129.          Dialogue, Flash and Query Boxes.
  130.          Menu Functions.
  131.          Window Functions.
  132.          Window Buffer Functions.
  133.          Window Colour Code Functions.
  134.          Speed Bar Functions.
  135.          Tool Bar Functions.
  136.          List functions.
  137.          Mouse And Miscellaneous Functions.
  138.          Cursor functions.
  139.          Keyboard functions.
  140.          Functions for Graphics Modes.
  141.          Popup Menu Functions.
  142.     Selected System Variables.
  143.          General system variables.
  144.          Window variables.
  145.          Menu variables.
  146.          Dialogue box, query and flash box variables.
  147.          Speed bar variables.
  148.          Tool bar variables.
  149.          Graphics mode variables.
  150.  
  151.  
  152.  
  153. SHAREWARE.
  154.  
  155. What is Shareware?
  156.  
  157. Shareware is an alternative to the usual way
  158. of distributing software.  With Shareware
  159. you can try out software before paying for
  160. it.  The software that you wish to evaluate
  161. is made available to you for free, or for a
  162. small charge that covers only the cost of
  163. the disk and copying process.  When you have
  164. used the software for a reasonable period,
  165. typically 30 days, you are expected to
  166. decide whether you wish to continue using
  167. it.  If you do, then you should register the
  168. software by sending payment directly to the
  169. author(s) according to the instructions that
  170. come with the software.  Depending on the
  171. software, one or more incentives may be
  172. offered to encourage your registration.  For
  173. example, you may receive the latest version
  174. of the software, or a version with added
  175. features.  You may also become eligible for
  176. technical help with the product.
  177.  
  178. Rules for Steph.
  179.  
  180. If you want to play with Steph, these are the rules:
  181. The Steph libraries are Shareware, as described above.
  182. If you continue to use the product after a trial period
  183. of approximately 30 days, and you have not already
  184. registered, you should register Steph by sending £25
  185. (Sterling) to:
  186.  
  187. Stephen Morphet,
  188. 49 Meadowfield Road,
  189. Stocksfield,
  190. Northumberland.
  191. ENGLAND.
  192. NE43 7PZ.
  193.  
  194. Registered users become eligible for peace of mind, and
  195. assistance with Steph by letter or E-Mail.  As a
  196. registered user you also gain the right to distribute
  197. programs that you write with Steph.  A printed copy of
  198. this manual will be supplied if requested.
  199.  
  200. INTRODUCTION.
  201.  
  202. Who is Steph?
  203.  
  204. Steph is a library of C functions for C programmers.
  205. She is designed to make it easy to create attractive text
  206. mode MSDOS applications for the IBM PC and compatibles.
  207. Steph allows these applications to take advantage of the
  208. wide range of windowing and menuing facilities that she
  209. provides.
  210.  
  211. Computer users these days expect software to be easy to
  212. use, with an attractive and intuitive interface.  This
  213. is not good news for programmers who are forced to
  214. spend more time on the look and feel of their program,
  215. and less time on the program itself.  By using a ready
  216. made interface, like Steph, you are once again free to
  217. concentrate on the important parts of your programs.
  218.  
  219. What kind of features does Steph provide?
  220.  
  221. Steph provides a windows and menus based interface, and
  222. will take advantage of a mouse where one is installed.
  223. Steph also provides dialogue boxes with a full range of
  224. controls, pop-up menus, a toolbar and a speed bar of
  225. buttons at the bottom of the screen.
  226.  
  227. Why does Steph use text mode?
  228.  
  229. Text mode is fast.  When text mode is sufficient to
  230. display the information from an application there is
  231. little reason to suffer the speed penalties of using a
  232. GUI such as Microsoft's Windows.  Many people still use
  233. DOS applications, and many programmers still develop
  234. DOS programs.
  235.  
  236. Steph is designed to work primarily in text modes,
  237. although a facility exists to run in graphics modes on
  238. EGA or VGA systems.  The character based environment is
  239. retained but windows may contain pixel graphics.
  240.  
  241. You will soon notice that the 'windows' provided by
  242. Steph are 'letter box slots.'  That is to say, each
  243. window occupies the full 80 column width of the screen
  244. and does not overlap with neighbouring windows.  In my
  245. experience The text mode screen (80 by 25 characters,
  246. or even larger 43 or 50 row modes) is not large enough
  247. to use overlapping, sizeable windows efficiently.
  248. Steph keeps the windows on the screen neatly ordered,
  249. and the fixed width means that they are large enough to
  250. display a useful amount of information.
  251.  
  252. The Steph Libraries.
  253.  
  254. Steph is supplied as a set of .LIB library files
  255. to link to your C programs.  Libraries are provided
  256. for MEDIUM or LARGE memory models, and for Microsoft C
  257. or Turbo C compilers.
  258.  
  259. The Microsoft libraries have been tested with Microsoft
  260. C/C++ 7.0 and Microsoft QuickC 2.5.  The Turbo C libraries
  261. have been tested with Turbo C++ 3 for DOS, and also seem
  262. to work with Borland C++ 3.0.
  263.  
  264. Library  Memory Model Complier
  265.  
  266. STEPH_M  Medium       Microsoft C
  267. STEPH_L  Large        Microsoft C
  268. TSTEPH_M  Medium       Turbo C
  269. TSTEPH_L  Large        Turbo C
  270.  
  271. Linking to a Steph library will add about 100K to the
  272. size of your executables.  This figure is affected by
  273. your choice of memory model,  and the use that your
  274. program makes of Steph's features.
  275.  
  276. The header file STEPH.H should be #include'd at the
  277. beginning of any source file that requires access to
  278. any of Steph's functions or data.
  279.  
  280. Disclaimer.
  281.  
  282. I can accept no liability of any kind, including loss
  283. or damage of any sort to hardware, software, or data
  284. that comes about through the use of, or inability to
  285. use any of the Steph libraries or any program created
  286. from them.
  287.  
  288. STEPH APPLICATIONS - AN OVERVIEW.
  289.  
  290. What bits does an application need?
  291.  
  292. Steph applications can be thought to consist of four
  293. major elements:
  294.  
  295. 1)  Menus.
  296. 2)  Windows.
  297. 3)  Dialogue boxes and other pop up windows.
  298. 4)  Code specific to the application.
  299.  
  300. The first three of these elements are looked after by
  301. Steph, and are concerned with the user interface to the
  302. program.  The fourth is the application itself, and is
  303. the responsibility of the programmer.
  304.  
  305. Menus.
  306.  
  307. Steph's menus appear at the top of the screen as a
  308. number of main headings on a menu bar.  The menus can
  309. be pulled down with the mouse or keyboard causing a
  310. number of options to appear.  A further selection may
  311. be made from these options.
  312.  
  313. Pop up menus can appear anywhere on the screen, and are
  314. similar in operation to the main menus.
  315.  
  316. Windows.
  317.  
  318. Windows fill the majority of the screen and are used to
  319. display data - for example one window may contain text
  320. in an editor, while another displays program output.
  321. One window, the main window, always exists.  Further
  322. windows can be added above or below it.  Windows can be
  323. resized, maximised, minimised and closed with the
  324. mouse.  They may also have scroll bars for navigation
  325. through the data.
  326.  
  327. Dialogue boxes and variations.
  328.  
  329. Dialogue boxes are used for communication with the
  330. program.  They can contain controls such as text entry
  331. fields, buttons, lists  and check boxes.  They can be
  332. operated by mouse and keyboard.
  333.  
  334. Query boxes are a special variation on dialogue boxes.
  335. A query box is used for example, to ask a simple
  336. question, where the response might be 'yes' or 'no', or
  337. perhaps the infamous 'Abort', 'Retry' or 'Fail'. The
  338. query box contains an area of text, and a number of
  339. option buttons.
  340.  
  341. A further variation is the Flash box.  This is a
  342. dialogue box with no controls and is used to display
  343. information in a non-interactive manner.  For example,
  344. a flash box might display the text, 'Thinking...' while
  345. the processor is busy.
  346.  
  347. The Toolbar.
  348.  
  349. The toolbar is an area at the top of the screen, below
  350. the menu bar, which can display a number of controls
  351. including buttons and combo boxes.  A toolbar is often
  352. seen, for example, in a word processor, where commonly
  353. used formatting options are available.
  354.  
  355. The Speed Bar.
  356.  
  357. The Speed Bar is the bottom row of the screen.  It is
  358. often used to display a set of possible current options
  359. in the form of a set of buttons.  The Speed Bar is also
  360. used to display helpful information when a dialogue
  361. box, query box or menu is active.
  362.  
  363. WRITING STEPH APPLICATIONS.
  364.  
  365. DEMO.C,  A sample application.
  366.  
  367. A sample application is provided in the file DEMO.C.
  368. The program does not perform any useful tasks:  It
  369. simply demonstrates many of the functions described
  370. below.
  371.  
  372. Hooks.
  373.  
  374. Hooks are the way to attach your own code to your Steph
  375. programs. For example, each menu option has an
  376. associated function hook.  A function attached to this
  377. hook will be executed when that menu option is
  378. selected. Similarly there are hooks on window controls,
  379. and on dialogue box controls.
  380.  
  381. A function to be attached to a hook can accept no
  382. parameters, nor can a value be returned.  Functions to
  383. be attached to hooks should therefore have prototypes
  384. as follows:
  385.  
  386.      void my_function( void );
  387.      
  388. The type vfnptr is defined in STEPH.H to describe a
  389. pointer to such a function.  For example:
  390.  
  391.      vfnptr p_function;
  392.      p_function = my_function;
  393.      
  394. To attach such a function to a hook, a pointer to the
  395. function is generally passed as a parameter to one of
  396. the 'build' functions supplied in Steph's library.  (Of
  397. course, there is usually no need to assign the pointer
  398. to an intermediate variable, as above.)  Steph will
  399. hang the function on the hook for you.
  400.  
  401. Information can be passed to and from these functions
  402. by means of global variables if that is necessary.
  403. Certain hook functions will need to make use of
  404. relevant data that is stored in global variables by
  405. Steph.
  406.  
  407. Initialising Steph.
  408.  
  409. Steph is initialised by calling the _steph_initialise
  410. function:
  411.  
  412.      if( !_steph_initialise( gmode ) )
  413.      {
  414.         printf( "Steph couldn't start in the current
  415.            screen mode." );
  416.         exit(0);
  417.      }
  418.      
  419. Where gmode specifies the screen mode type:  M_TEXT or
  420. M_GRAPHIC.  We will assume M_TEXT for the time being.
  421. Graphics modes are discussed in due course.
  422.  
  423. When this function has returned TRUE, Steph is ready to
  424. be set up for use.  Steph starts up in the current
  425. video mode, which should be either mode 2 or 3, for
  426. colour text, or mode 7 on monochrome systems.  You may
  427. wish to set the screen mode before calling
  428. _steph_initialise.  If you want to set EGA and VGA
  429. systems into 43 or 50 line modes you should also do
  430. this before calling _steph_initialise.
  431.  
  432. If an application is written with sufficient
  433. consideration given to the size of dialogue boxes,
  434. menus and other screen elements, it will be able to
  435. adapt automatically to the number of screen rows in
  436. use.
  437.  
  438. Menus
  439.   
  440.   Building Menus.
  441.   
  442. When a menu structure has been decided upon it is
  443. defined using the _menu_build function as follows:
  444.  
  445.      _menu_build( 0,     /* menu number */
  446.         "&Moo",          /* title text */
  447.         "&Oink",         /* list of pull down items */
  448.         "=",
  449.         "Ba&a",
  450.         "Snu&ffle",
  451.         NULL );          /* list terminator */
  452.      
  453. The first parameter is the menu code number.  This
  454. number identifies the menu and should be between 0 and
  455. 15.
  456.  
  457. The second parameter is the text for the menu heading
  458. which will appear on the top row of the screen.  The
  459. Ampersand (&) does not appear but is used to specify
  460. which character is the hotkey for this menu.  In this
  461. case it is the 'M' as this is the character that
  462. appears immediately after the '&'.  Note that a text
  463. need not contain an ampersand, in which case no hotkey
  464. will be assigned.
  465.  
  466. The following parameters specify the texts that will
  467. appear in the pull down menu below the 'Moo' heading.
  468. The NULL is used to terminate the list. This menu
  469. therefore has four pull down options: 'Oink', '=',
  470. 'Baa', and 'Snuffle'.  The second of these ('=') is
  471. special, indicating a horizontal bar across the menu at
  472. this point, and does not actually appear as an '='
  473. sign.  A normal menu item may not begin with the '='
  474. character.
  475.  
  476. Menus will appear from left to right along the menu bar
  477. in the order that they are built.  A menu can be made
  478. to appear on the right of the menu bar by prefixing the
  479. menu title with the caret character '^'.  For example:
  480.  
  481.      _menu_build( 1,
  482.         "^&Squeak",
  483.         "S&quelch",
  484.         "&Snort",
  485.         "&Tickle",
  486.         NULL );
  487.      
  488. Would create a menu titled 'Squeak' at the right hand
  489. side of the menu bar, with three pull down options
  490. below it.  Menus created at the right hand side of the
  491. menu bar appear from right to left in the order in
  492. which they were built.  The caret prefix has no effect
  493. other than in the menu title text.
  494.  
  495. The following code fragment demonstrates two further
  496. options that can be applied to menu items:
  497.  
  498.      _menu_build( 2,
  499.         "&Quack",
  500.         "$Duck&1",
  501.         "?Duck&2",
  502.         "Duck&3",
  503.         NULL );
  504.      
  505. The interesting items here are the first pull down item
  506. "$Duck&1" and the second "?Duck&2".
  507.  
  508. The dollar sign prefix '$' is valid in title texts or
  509. pull down item texts and indicates that the option is
  510. 'greyed out' or unavailable.  If the title text is
  511. greyed out, the menu cannot be opened.  If an option
  512. text is greyed out that option cannot be selected.
  513.  
  514. The question mark prefix '?' is valid only in pull down
  515. item texts and indicates that the item has a check mark
  516. displayed next to it.  The item is initialised with the
  517. check set to TRUE.  A function _menu_toggle is provided
  518. which can be hooked to such a menu option in order to
  519. toggle the check mark when the item is selected.
  520.  
  521. A percent sign prefix '%' also indicates that a menu
  522. item is checkable, but that the item starts without a
  523. check mark.  Menu items defined without a dollar sign
  524. '$' or percent sign '%' cannot be checked..
  525.  
  526. It is possible to redefine a menu by calling
  527. _menu_build again.  This will overwrite any menu
  528. currently defined with the same menu number.
  529.  
  530. Menu item numbering is as follows:  Item zero is the
  531. title item.  Item one is the first pull down option
  532. item, and numbering continues 1, 2, 3, etc. for each
  533. option.  Greyed out items and horizontal bars are
  534. included in the numbering scheme, although they cannot
  535. be selected.
  536.  
  537.   Attaching functions to menus.
  538.   
  539. A function hook is provided for each of the pull down
  540. options in a menu.  Functions are attached by means of
  541. the _menu_functions function:
  542.  
  543.      _menu_build( 1,
  544.         "&Quack",
  545.         "$Duck&1",
  546.         "?Duck&2",
  547.         "Duck&3",
  548.         NULL );
  549.      
  550.      _menu_functions( 1,      /* menu code number */
  551.         NOFN,                 /* no function */
  552.         _menu_toggle,         /* the toggle function */
  553.         function1 );          /* a user function */
  554.      
  555. The example  above shows functions attached to the
  556. three options "Duck1", "Duck2" and "Duck3" in the
  557. "Quack" menu. The function attached to "Duck1" is the
  558. constant NOFN, indicating that in this case, no
  559. function is attached.  This is the default for all
  560. options as soon as they are built.  The _menu_toggle
  561. function is attached to the option "Duck2".  Note that
  562. "Duck2" was specified with a check mark in the
  563. _menu_build call.  _menu_toggle is used to change the
  564. state of the check mark whenever the option is
  565. selected.  The final option "Duck3" has a function
  566. function1 attached.  This specifies that one of your
  567. own functions is to be used here.  function1 should be
  568. defined elsewhere as:
  569.  
  570.      void function1( void );
  571.      
  572.   Adding help text to menus.
  573.   
  574. A text appears on the speed bar at the bottom of the
  575. screen to give further information about the currently
  576. selected menu item. These texts are set using
  577. _menu_helptext:
  578.  
  579.      _menu_helptext( number,
  580.         "Help for the title item.",
  581.         "Help for the first pull down item.",
  582.         "Second pull down item.",
  583.         "And the third." );
  584.      
  585. Texts should be supplied for the main title item and
  586. for each pull down option.  You should replace a string
  587. with NOTEXT if you want no text to be displayed for
  588. that option.
  589.  
  590.   Checkable items.
  591.   
  592. When a menu item is defined using the '$' or '%'
  593. prefixes it is a checkable item.  When the check is
  594. TRUE a tick or mark will be displayed in the menu
  595. before the item text.  When the check is FALSE there
  596. will be nothing displayed, although these characters
  597. can be redefined, for example to show a tick and a
  598. cross.
  599.  
  600. As described above, a checkable item can be toggled by
  601. attaching the _menu_toggle function to the item.  This
  602. function will automatically toggle the check mark on
  603. the most recently selected menu item. If there is
  604. already another function attached to the hook you could
  605. call _menu_toggle from inside that function.
  606.  
  607. When you wish to change a check mark at a time other
  608. than immediately after that menu item has been selected
  609. you should use the _menu_check function, where the menu
  610. and item numbers must be specified:
  611.  
  612.      _menu_check( menu_number, item_number, check );
  613.      
  614. Check can be one of the constants CHECKON or CHECKOFF
  615. which set the check to TRUE or FALSE respectively, or
  616. CHECKTOGGLE which will change the state of the check
  617. mark regardless of its current state.
  618.  
  619. To determine the state of a checkable item, use the
  620. following function:
  621.  
  622.      state = _menu_get_check( menu_number,
  623.         item_number );
  624.  
  625. This function will return CHECKON, CHECKOFF, or NOCHECK
  626. if the item is not checkable.
  627.  
  628.   Grey items.
  629.   
  630. When a menu title or option item is set to be 'greyed
  631. out' it becomes impossible to select that item.  This
  632. is useful to prevent the user making selections that
  633. are not appropriate at that time.  Items are set to be
  634. grey by prefixing the menu text with the dollar '$'
  635. character in the call to _menu_build.
  636.  
  637. The state of a menu items greyness can be controlled
  638. using the _menu_enable function.
  639.  
  640.      previous_state = _menu_enable( menu_number,
  641.         item_number, state );
  642.      
  643. Where the menu number is the menu index used in
  644. _menu_build, and the item number specifies the option
  645. for which the greyness is to be altered.  In the item
  646. number zero specifies the main menu title, and options
  647. are numbered from one upwards.  The state code passed
  648. should be either of the constants ENABLED or DISABLED.
  649. The code returned by the function will also be one of
  650. these.
  651.  
  652.   Using Menus.
  653.   
  654.   Keyboard.
  655.   
  656. The menus are activated by pressing the ALT key.  A
  657. highlight appears on the menu bar over the text for
  658. menu zero.  The highlight can be moved between menus
  659. with the cursor left and right keys.  Pressing one of
  660. the highlighted hotkeys will cause the associated menu
  661. to be opened. Pressing cursor up, cursor down, space or
  662. enter will cause the highlighted menu to be opened (if
  663. it is not greyed out), and the highlight will move to
  664. the first option.
  665.  
  666. The up and down cursor keys now serve to highlight
  667. options from the menu.  The cursor wraps around from
  668. top to bottom, and skips over horizontal bars. Items
  669. can be selected with the enter key or space bar,
  670. provided they are not greyed out.  Pressing left and
  671. right cursor keys at this stage opens the menu to the
  672. left or right of the current menu.  Pressing a
  673. highlighted hotkey selects an item.
  674.  
  675. Once an item is selected the menu is closed and the
  676. attached function for the selection is called.
  677.  
  678. You can exit from the menus at any point by pressing
  679. ESC or ALT.
  680.  
  681.   Mouse.
  682.   
  683. The menus can be activated by clicking on one of the
  684. texts on the menu bar with the mouse.  The menu is
  685. opened, and the mouse can be used to drag the highlight
  686. bar to an option, by holding down the button, in which
  687. case the option will be selected when the button is
  688. released.  Alternatively, the button can be released
  689. over the title text, in which case the menu remains
  690. open and an option can be selected by clicking it once.
  691.  
  692. Other menus can be opened by clicking the title with
  693. the mouse, in which case the current menu is closed.
  694.  
  695. Note that you can switch between mouse and keyboard
  696. operation at any stage.
  697.  
  698. Windows
  699.  
  700.   Building Windows.
  701.   
  702. Windows are created with the _window_build function:
  703.  
  704.      _window_build( number, position, height, "The
  705.         Title", filter, keyaction, mouseaction );
  706.      
  707. The number is used to identify the window.  The first
  708. window built should be the main window, which is always
  709. window zero.  For example:
  710.  
  711.      _window_build( 0, WP_MAIN, 0, "Main Window", NOFN,
  712.         NOFN, NOFN );
  713.      
  714. The height parameter for the main window has no effect,
  715. since the main window always expands to fill the space
  716. unused by other windows.  It has been set to zero here.
  717.  
  718. The main window is always created with horizontal and
  719. vertical scroll bars, and a maximise button.  The three
  720. function hooks are used to define the way in which the
  721. window responds to keyboard and mouse, and will be
  722. described later.
  723.  
  724. Subsequent windows are defined in a similar way, using
  725. _window_build.  They should be given positions WP_TOP
  726. or WP_BOT.  One restriction exists in that all windows
  727. must be given consecutive numbers, as an undefined
  728. window will be treated as the end of the list.  The
  729. second restriction is that windows  defined as 'top
  730. windows' with WP_TOP must appear BEFORE any WP_BOT
  731. windows in the list.  Any window listed after the first
  732. occurrence of a WP_BOT  window will be treated as a
  733. 'bottom window' regardless of the position value
  734. assigned to it.
  735.  
  736. The following example defines five windows:
  737.  
  738.      _window_build( 0, WP_MAIN, 0, "0 The Title",
  739.      NOFN, NOFN,
  740.         NOFN );
  741.      
  742.      _window_build( 1, WP_TOP,  2, "1 Topper than
  743.      that", NOFN,
  744.         NOFN, NOFN );
  745.      
  746.      _window_build( 2, WP_TOP,  2, "2 Top Window",
  747.      NOFN, NOFN,
  748.         NOFN );
  749.      
  750.      _window_build( 3, WP_BOT,  3, "3 Bottom Window"
  751.      NOFN, NOFN,
  752.         NOFN );
  753.      
  754.      _window_build( 4, WP_BOT,  3, "4 Nearly the
  755.      bottom", NOFN,
  756.         NOFN, NOFN );
  757.      
  758. Note that window zero is the main window.  It is
  759. followed by the two top windows, and finally two bottom
  760. windows.  The title is displayed on the top border of
  761. the window when it is displayed on screen.
  762.  
  763. Top windows 'hang' from the top of the screen with
  764. lower numbered windows highest up. The bottom windows
  765. 'pile up' at the bottom of the screen with lower
  766. numbers lower down.  The height parameter is used to
  767. set the initial height of the top and bottom windows.
  768. The height refers to the number of rows inside the
  769. window, excluding the 'frame' or border.
  770.  
  771. Windows are created with a default set of controls:
  772. Each window has both horizontal and vertical scroll
  773. bars, a close button (except the main window, which
  774. cannot be closed) and a maximise button which changes
  775. to a minimise button as appropriate.
  776.  
  777. You can change the controls present on a window using
  778. the function _window_controls:
  779.  
  780.      _window_controls( window, controls );
  781.      
  782. Where window is the number of the window to alter, and
  783. controls is a byte indicating which controls are to be
  784. used.  There are a number of constants which can be
  785. used:
  786.  
  787. WC_CLOSE       A close button.
  788. WC_MAX         A maximise button.
  789. WC_MIN         A minimise button.
  790. WC_HSCROLL     Horizontal scroll bar.
  791. WC_VSCROLL     Vertical scroll bar.
  792.  
  793. These can be combined with C's bitwise OR operator '|'
  794. For example:
  795.  
  796.      _window_controls( 1, WC_CLOSE | WC_MAX );
  797.      
  798. This would give window one close and maximise buttons,
  799. and turn off all others.
  800.  
  801. If you attempt to give the main window a close button
  802. it will have no effect.  Similarly maximise buttons
  803. will be ignored on windows that are currently maximised
  804. (these display a minimise button) and minimise  buttons
  805. are ignored on windows that are not maximised.  If you
  806. do not know whether a window is maximised, or cannot be
  807. bothered to find out, it is safe to attempt to set both
  808. buttons and Steph will add the appropriate one, e.g.:
  809.  
  810.      _window_controls( 1, WC_CLOSE | WC_MAX | WC_MIN |
  811.         WC_VSCROLL | WC_HSCROLL );
  812.      
  813. This line effectively sets the controls options to the
  814. defaults for a top or bottom window.
  815.  
  816.   The keyboard and windows.
  817.   
  818. The behaviour of each window is dependant on the
  819. application.  It will be required to respond to certain
  820. keystrokes and ignore others.  Two of the three
  821. function hooks specified in _window_build can be used
  822. to specify this behaviour.
  823.  
  824. Each window can have a filter function and a keyboard
  825. action function attached via hooks.  When Steph detects
  826. a keystroke that is not intercepted at the system level
  827. (see the discussion of system level keystrokes later)
  828. it is passed to the filter function for the current
  829. active window.  This filter decides if the keystroke is
  830. to be used or discarded, and if it is to be used, Steph
  831. will call the keyboard action function to act upon it.
  832.  
  833.   Implementing filter and action functions.
  834.   
  835. The default filter is implemented by leaving the filter
  836. function pointing to NOFN.  The default filter passes
  837. the cursor keys and alphanumeric keys (those with ASCII
  838. codes in the range 32 to 126).  For most situations,
  839. where this selection is inappropriate, the user must
  840. write their own filter, as follows:
  841.  
  842. The filter must have the same prototype as for any
  843. hooked function:
  844.  
  845.      void filter_function( void );
  846.      
  847. It can therefore accept no parameters.  The keystroke
  848. should be read from the global variable _window_spec:
  849.  
  850.      _window_spec.key1
  851.      _window_spec.key2
  852.      
  853. One or the other of these values will be zero.
  854. Normally key1 will contain the ASCII code of the key
  855. pressed, and key2 will be zero.  When key1 is zero,
  856. key2 contains the extended code, such as is generated
  857. by the getch function when a cursor key, for example,
  858. is pressed.
  859.  
  860. From the information in key1 and key2 the decision as
  861. to whether the keystroke must be passed can be made.
  862. If the key is to be passed, the key1 and key2 variables
  863. should be left unchanged and the function exited.  If
  864. the key is not to be passed, then both key1 and key2
  865. should be set to zero, before exiting the function.
  866.  
  867. When the filter passes a keystroke the keyboard action
  868. function for the window is called, provided that one
  869. has been defined.  There is no default function in this
  870. case.  The keyboard action function should also read
  871. the key1 and key2 variables in _window_spec in order to
  872. determine the action to be taken.
  873.  
  874.   Examples:
  875.   
  876. 1) If a window accepts no input, the keyboard action
  877. function will  be NOFN. It is also unnecessary to
  878. provide a filter (i.e. you can set  it to NOFN, for the
  879. default filter) since Steph will not bother  to filter
  880. keystrokes if she sees that there is no keyboard action
  881. function.
  882.  
  883. 2) A text editor in a window would require that almost
  884. all  keystrokes were passed.  A user defined filter
  885. function is  required.  The keyboard action function
  886. can then perform the editing operations, such as
  887. inserting text, moving around with  cursor keys, etc.
  888.  
  889. The third function pointer passed to _window_build is
  890. called mouseaction.  It is reserved for use in future
  891. versions of Steph and  should be set to NOFN every
  892. time.  Functions attached to this hook will never be
  893. called by this version of Steph.
  894.  
  895.   The mouse and windows.
  896.   
  897. Steph handles many of the basic mouse/window
  898. interactions such as resizing, closing, maximising, and
  899. scroll bar use.  However, a hook is provided at each of
  900. the following mouse/window events:
  901.  
  902. Buttons and resizing.
  903. close            - Called when the close button is
  904.                    pressed.
  905. max              - Called when the maximise button is
  906.                    pressed.
  907. min              - Called when the minimise button is
  908.                    pressed.
  909. size             - Called when the title bar is dragged
  910.                    to resize the window.
  911.  
  912. Vertical scroll bar actions.
  913. vup              - Called when the scroll bar up arrow
  914.                    is clicked.
  915. vdown            - Called when the scroll bar down
  916.                    arrow is clicked.
  917. vdrag            - Called when the scroll bar's blip is
  918.                    dragged.
  919. vpup             - Called when the scroll bar is
  920.                    clicked above the blip.
  921. vpdown           - Called when the scroll bar is
  922.                    clicked below the blip.
  923.  
  924. Horizontal scroll bar actions.
  925. hup              - Called when the scroll bar up arrow
  926.                    is clicked.
  927. hdown            - Called when the scroll bar down
  928.                    arrow is clicked.
  929. hdrag            - Called when the scroll bar's blip is
  930.                    dragged.
  931. hpup             - Called when the scroll bar is
  932.                    clicked above the blip.
  933. hpdown           - Called when the scroll bar is
  934.                    clicked below the blip.
  935.  
  936. Selection functions.
  937. unselect         - Called for the previous active
  938.                    window when the active window is changed
  939.                    by a mouse action.
  940. select           - Called when the window becomes
  941.                    active due to  a mouse action, or when the
  942.                    window is clicked over the window 'pane'.
  943.  
  944. Activation function.
  945. activate         - This hook is called when a window
  946.                    becomes active as a  result of a mouse
  947.                    action taking place on another window. At
  948.                    present, this occurs only when another
  949.                    window is  closed, and the window below it
  950.                    becomes active.
  951.  
  952. These seventeen function hooks are set using the
  953. function _window_mouse_functions which has the
  954. following form:
  955.  
  956.      void _window_mouse_functions( window_number,
  957.      close,
  958.         max, min, size, vup, vdown, vdrag, vpup,
  959.      vpdown,
  960.         hup, hdown, hdrag, hpup, hpdown, unselect,
  961.      select,
  962.         activate );
  963.      
  964. The mouse buttons which cause these events are, by
  965. default, that either button can cause a 'select' event,
  966. and the left button must be used to operate any of the
  967. controls.  These defaults can be changed by setting the
  968. _window_spec.mousecode and _window_spec.mousecontrol.
  969. The mousecode variable indicates the set of buttons
  970. which will cause a 'select' event.  The mousecontrol
  971. variable indicates which button will cause a control to
  972. operate, with the restriction that it must be a subset
  973. of the set defined by mousecode.
  974.  
  975. The window_number parameter specifies the window to
  976. which these functions are to be attached.  The
  977. following sixteen parameters are the function pointers,
  978. which may be set to NOFN if no code is to be attached
  979. to a particular hook.
  980.  
  981. Note that these functions are only called when a mouse
  982. event occurs on  a window.  If windows are closed,
  983. maximised, etc. by another part of the program they are
  984. not called.  It is the task of the programmer to
  985. maintain consistency in the behaviour of the program if
  986. there exist multiple methods of, for example, closing a
  987. window.
  988.  
  989.   Notes on using the scroll bar hooks.
  990.   
  991. When a scroll bar event occurs, Steph runs the
  992. appropriate function as defined in
  993. _window_mouse_functions .  This function is responsible
  994. for updating the scroll 'blip' positions stored in
  995. _window[].vsblip and _window[].hsblip.  Steph does not
  996. alter these values automatically, as the programmer may
  997. wish to change the behaviour of the scroll bar to suit
  998. the application.  When a scroll bar 'drag' event has
  999. occurred the new blip position is made available in
  1000. _window_spec.scrinfo for use by the handler function.
  1001.  
  1002. Use of the scroll bars is demonstrated in the EDITOR.C
  1003. example program.
  1004.  
  1005. A minimum program.
  1006.  
  1007. The information presented so far, on menus and windows,
  1008. is sufficient to write the most basic of programs:
  1009.  
  1010. A minimum program must perform a number of 'setup'
  1011. steps before it can be started:
  1012.  
  1013. 1) Initialise Steph, having chosen the screen mode if
  1014.    necessary.
  1015. 2) Build at least one menu.
  1016. 3) Build the main window, and any others that are
  1017.    required.
  1018. 4) Issue the function call: _steph_go(); to begin.
  1019.  
  1020. Note that Steph provides no means of exiting the
  1021. program.  The user must provide a function, perhaps
  1022. attached to an 'Exit' menu option to perform the
  1023. following:
  1024.  
  1025. 1) Issue the function call  _steph_closedown();
  1026. 2) Exit the program.  e.g.  exit( 0 );
  1027.  
  1028. Note that the program must exit after _steph_closedown
  1029. has been called.  Steph will behave unpredictably if
  1030. the user function is allowed to return and Steph is
  1031. allowed to continue running after the closedown
  1032. function has been called.
  1033.  
  1034. You will now know enough to get a simple application
  1035. working with Steph. There are however, a large number
  1036. of further features which add greatly to Steph's
  1037. capabilities, and should be taken advantage of in order
  1038. to create a polished application.  These features are
  1039. described in the following sections.
  1040.  
  1041. The keyboard at 'system level'.
  1042.  
  1043. It has been described above how a filter and action
  1044. function can be attached to each window in order to
  1045. handle keystrokes. It is also possible to add a global,
  1046. or so called 'system level' keyboard filter and action
  1047. function, which will have a look at each keystroke and
  1048. steal it from the active window if it is passed by the
  1049. filter. This facility might be used, for example, if
  1050. you wanted to use the F6 key to move the focus to the
  1051. next window on the screen.  This action occurs
  1052. regardless of the currently active window, and so
  1053. should be handled at system level.
  1054.  
  1055. To set the filter and action functions use the
  1056. function:
  1057.  
  1058.      _window_setsyskey( filter_function,
  1059.      action_function );
  1060.      
  1061. Where filter_function and action_function are pointers
  1062. to functions of the type:
  1063.  
  1064.      void function( void );
  1065.      
  1066. The action of the filter function differs slightly to
  1067. those used for keystrokes in windows.  The keystrokes
  1068. are made available in _window_spec.key1 and
  1069. _window_spec.key2 as before, but in order to indicate
  1070. that the keystroke has been grabbed at the system
  1071. level, the variable _window_spec.syskeyflag should be
  1072. set to TRUE.  If the key is not to be passed by the
  1073. system key filter _window_spec.syskeyflag should be set
  1074. to FALSE.
  1075.  
  1076. The values in _window_spec.key1 and _window_spec.key2
  1077. should not be altered because Steph still has to pass
  1078. the keystrokes to the filter function for the active
  1079. window.  If the key values are changed then the new
  1080. values will be passed on to the active window.
  1081.  
  1082. If the keystroke is passed by the filter, the action
  1083. function will be called, and the keystroke will not be
  1084. made available to the active window's filter function.
  1085.  
  1086. Flash Boxes.
  1087.  
  1088. Flash boxes are used to display information on the
  1089. screen in a non-interactive manner.  Typical uses might
  1090. be to display status or error messages as a program
  1091. executes.  Interactive messages are provided for with
  1092. Query Boxes (see later).
  1093.  
  1094. A flash box is displayed with the function:
  1095.  
  1096.      _flash_box( position, textlist );
  1097.      
  1098. The position variable can be either DB_CENSCR to centre
  1099. the flash box  on the screen, or DB_CENWIN to centre
  1100. the flash box over the active window.  Flash boxes
  1101. cannot be given absolute positions.
  1102.  
  1103. The variable textlist is a pointer to a dynamically
  1104. allocated list, as is created by the function
  1105. _s_buildlist .  The items in this list are the  lines
  1106. of text to be displayed in the flash box.  For example:
  1107.  
  1108.      _flash_box( DB_CENSCR, _s_buildlist(
  1109.         "The top line\0The second line.\0" );
  1110.      
  1111. would display the texts, 'The top line' and 'The second
  1112. line' in the flash box.  
  1113.  
  1114. Steph provides a number of functions for working with
  1115. lists.  These are described in another part of this manual.
  1116.  
  1117. If a flash box is already on the screen it will be
  1118. removed, and the new one drawn in its place.  The last
  1119. flash box on the screen can be removed with:
  1120.  
  1121.      _flash_box_remove();
  1122.      
  1123. Building Dialogue Boxes.
  1124.  
  1125. A dialogue box is an interactive form-like control that
  1126. takes information from the user.  Flash boxes and query
  1127. boxes (which are discussed later) are in fact derived
  1128. from the more sophisticated dialogue box.  The dialogue
  1129. box has a number of controls, each of which may be one
  1130. of a number of types:
  1131.  
  1132. FrameA non interactive box on the form, with title.
  1133. LabelNon interactive text,  placed on the form.
  1134. ButtonPressable button, with text inside.
  1135. Check boxA box that can be 'checked', i.e. yes/no info.
  1136. Radio buttons    A number of buttons, one checked at a time.
  1137. TextA box that you can enter text into.
  1138. ListAllows selection of a choice from a list.
  1139. ComboLike a pop up list.
  1140.  
  1141. Dialogue boxes can be built before they are needed,
  1142. typically at the beginning of the program using the
  1143. function:
  1144.  
  1145.      _dbox_build( number, position, xsize, ysize,
  1146.      controls,
  1147.         title, helptext );
  1148.      
  1149. Where number is the number of the dialogue box, in the
  1150. same way that menus and windows are all identified by
  1151. number.  The parameter position is used to specify the
  1152. way the dialogue is displayed on screen.  It may take
  1153. the  following values.
  1154.  
  1155. CENSCRCentre the dialogue on the screen.
  1156. CENWINCentre the dialogue on the current window.
  1157. ABSPOSAbsolute position.
  1158.  
  1159. The xsize and ysize parameters define the size of the
  1160. box, measured inside the borders.  The controls
  1161. parameter specifies the number of controls which the
  1162. box will contain.
  1163.  
  1164. The helptext is a pointer to a string that will be
  1165. displayed on the speed bar while the dbox is on screen.
  1166.  
  1167. For example,
  1168.  
  1169.      _dbox_build( 0, CENSCR, 20, 10, 2, "A sample
  1170.         box.", "This is a test." );
  1171.      
  1172. would create dialogue box zero, centred on the screen,
  1173. twenty characters wide and ten deep, with two controls.
  1174. The dialogue would have the title "A sample box." on
  1175. its top edge, and the speed bar would display the words
  1176. "This is a test." when the dialogue was on screen.
  1177.  
  1178. If a dialogue box is defined with ABSPOS position, the
  1179. position of the top left corner of the box is
  1180. positioned with the function:
  1181.  
  1182.      _dbox_setabspos( number, xpos, ypos );
  1183.      
  1184. Where number is the box number as set in _dbox_build(),
  1185. and xpos and ypos measure the position of the box in
  1186. characters.  The top left of the screen is (1, 1).
  1187.  
  1188. The dialogue box is currently empty, and so cannot be
  1189. displayed.  We must therefore fill it with controls.
  1190.  
  1191.   Adding controls to Dialogue Boxes.
  1192.   
  1193. A function exists to add each control type to a
  1194. dialogue:
  1195.  
  1196.   Frame:
  1197.   
  1198. A non interactive box, drawn on the dialogue, with
  1199. optional text centred in the top edge.
  1200.  
  1201.      _dbox_c_frame( dbox, control, xpos, ypos, xsize, 
  1202.         ysize, titletext );
  1203.      
  1204. The dbox parameter refers to the dialogue box number
  1205. specified in _dbox_build().  Control is the number of
  1206. the control in the dialogue. The numbering of controls
  1207. dictates the tabbing order.  For a dialogue with ten
  1208. controls, they will be numbered from zero to nine.
  1209. Numbers should be consecutive, as an undefined control
  1210. is treated as the end of the list.
  1211.  
  1212. The xpos and ypos parameters position the control
  1213. relative to the top left hand corner of the dialogue.
  1214. The top left corner of the dialogue (just inside the
  1215. border) is (1, 1).
  1216.  
  1217. The xsize and ysize parameters determine the size of
  1218. the frame.  The  title of the frame is set by the
  1219. pointer to a string, titletext.  Clearly this should
  1220. not be longer than the xsize of the frame.  If the
  1221. pointer is left NULL, then the frame will be untitled.
  1222.  
  1223.   Label:
  1224.   
  1225. Non interactive.  A label places a piece of text on the
  1226. dialogue.
  1227.  
  1228.      _dbox_c_label( dbox, control, xpos, ypos,
  1229.         labeltext );
  1230.      
  1231. Dbox and control are used as described above.  Xpos and
  1232. ypos position the beginning of the label text relative
  1233. to the top left corner of the  dialogue.  Labeltext is
  1234. a pointer to a string which is the text of the label.
  1235.  
  1236.   Button:
  1237.   
  1238. A button can be pressed with the mouse or keyboard.  A
  1239. return value is set that can be interrogated by the
  1240. application.  A function can be attached via a hook,
  1241. that will be called when the button is pressed.
  1242.  
  1243.      _dbox_c_button( dbox, control, xpos, ypos, width,
  1244.         buttontext, exitmode, function );
  1245.      
  1246. Dbox, control, xpos and ypos are as above.  Width
  1247. defines the width of the button, i.e. the space between
  1248. the enclosing chevrons.
  1249.  
  1250. Buttontext is a pointer to the text that appears in the
  1251. button.  It may contain an ampersand '&' to define a
  1252. hotkey, as for menu items.
  1253.  
  1254. The exitmode parameter determines whether the dialogue
  1255. box should be closed when the button has been pressed.
  1256. It can be set to EXIT or NOEXIT.  A further constant
  1257. ESCAPE can be used.  This is similar to EXIT, but it
  1258. causes the data in the dialogue to be restored to its
  1259. entry values, as if the escape key had been pressed.
  1260.  
  1261. Function is a pointer to a normal hooked function.
  1262. This function will be called as soon as the button is
  1263. pressed, and on return, the dialogue will examine
  1264. exitmode to determine the action to be taken.
  1265.  
  1266.   Check box:
  1267.   
  1268. A check box has a title, followed by a small box in
  1269. which a check mark  may or may not be displayed.  The
  1270. check can be toggled by the user with the keyboard or
  1271. the mouse.  Check boxes are typically used as simple
  1272. switches, where an on/off or yes/no type response is
  1273. required.
  1274.  
  1275.      _dbox_c_check( dbox, control, xpos, ypos,
  1276.         checktext, initialvalue, function );
  1277.      
  1278. Checktext is the title of the control.  It may contain
  1279. an ampersand '&' to specify a hotkey.  The box itself
  1280. appears at the end of this text.
  1281.  
  1282. Initialvalue can be set to TRUE or FALSE.  TRUE
  1283. indicates that the checkbox starts life with a check
  1284. mark, and FALSE indicates that it begins empty, or
  1285. unchecked.
  1286.  
  1287. Function is a hooked function that is called when the
  1288. state of the check box is changed.
  1289.  
  1290.   Radio buttons:
  1291.   
  1292. Radio buttons are like the push-button waveband
  1293. selectors on a radio.  They are used when the user must
  1294. always choose one, and only one from a number of
  1295. options. When one is pressed, the previous selection
  1296. becomes deselected.  Like when you press the FM button,
  1297. and the long wave button pings out!
  1298.  
  1299.      _dbox_c_radio( dbox, control, buttonlist,
  1300.         initialitem, function );
  1301.      
  1302. Buttonlist is a pointer to an area of dynamic memory
  1303. where a definition of the set of buttons is stored.  It
  1304. must be defined using the _s_build_radiolist()
  1305. function.  The list takes the form:
  1306.  
  1307. item 0  byte xpos
  1308.         byte ypos
  1309.         byte hotkey
  1310.         byte alpha
  1311.         byte greyness
  1312.         "text"
  1313. ...
  1314.  
  1315. item n  byte xpos
  1316.         byte ypos
  1317.         ...
  1318.         "text"
  1319.  
  1320. The hotkey and alpha bytes are for internal use and
  1321. should be set to zero. The greyness byte will be
  1322. discussed later - we will set it to zero for now.
  1323.  
  1324. Example code:
  1325.  
  1326.      char *radiolist;
  1327.      radiolist = _s_build_radiolist(
  1328.         "\x03\x05\x00\x00\x00Button&1\0"
  1329.         "\x03\x06\x00\x00\x00Button&2\0\0" );
  1330.      _dbox_c_radio( 0, 1, radiolist, 0, NOFN );
  1331.      
  1332. This would define a radio button set with two buttons,
  1333. titled 'Button1' and 'Button2', and add it to dialogue
  1334. box 0 as control 1.
  1335.  
  1336. Button 'one' is positioned at x=3, y=5, relative to the
  1337. top left of the dialogue.  These two bytes are followed
  1338. by three zero bytes for hotkey, alpha and greyness.
  1339. The text begins immediately after the greyness byte,
  1340. and may contain an ampersand to define hotkeys.  The
  1341. text is terminated by a zero byte '\0', and then the
  1342. list continues with the definition for button 'two'.
  1343. This is positioned at x=3, y=6, immediately below the
  1344. first button.  There are three zero bytes, followed by
  1345. the text 'Button&2' and  a further '\0' to terminate
  1346. the string.  The list is terminated by ending the final
  1347. string with a pair of zero bytes '\0\0', rather than
  1348. just one.
  1349.  
  1350. The initialitem parameter indicates which item is
  1351. checked, i.e. which button is pressed when the radio
  1352. button set is defined.  The function parameter
  1353. specifies a hooked function which is called whenever
  1354. the button selection changes.
  1355.  
  1356.   Text:
  1357.   
  1358. A text box has a title followed by a single line box in
  1359. which text can be entered and edited.
  1360.  
  1361.      _dbox_c_text( dbox, control, xpos, ypos, size,
  1362.         titletext, initialtext, function, filter );
  1363.      
  1364. Xpos and ypos position the first character of the
  1365. title.  Size specifies the length of the text box,
  1366. although the text itself can be up to 1024 characters
  1367. long and is scrolled by Steph.
  1368.  
  1369. The title text is given in the normal way, with a
  1370. pointer to a string.  The initial text that will appear
  1371. in the text window must be specified with a pointer to
  1372. a dynamically allocated string, i.e. memory allocated
  1373. by one of the malloc family of functions.  This is
  1374. because Steph will need to 'realloc' this space when
  1375. the text is edited.
  1376.  
  1377. You can use strdup to create a dynamic copy of a string
  1378. constant:
  1379.  
  1380.      _dbox_c_text( 0, 2, 1, 1, 16, "Ti&tle",
  1381.         strdup("Initial text in the text box!" ),
  1382.         NOFN, NOFN );
  1383.      
  1384. Function specifies a hooked function which is called
  1385. when the RETURN key is pressed in the text box.
  1386.  
  1387. Filter specifies a key filter function which can be
  1388. used to restrict the characters that can be entered
  1389. into the text box.
  1390.  
  1391. The filter function must read the character from the
  1392. global variable _dbox_spec.filter_key.  If the key is
  1393. to be passed, the key should be left in the filter_key
  1394. variable.  If the key is not to be passed by the filter
  1395. this variable should be set to zero.
  1396.  
  1397. If the filter function pointer is set to NOFN, a
  1398. default filter will be applied, which passes characters
  1399. in the range ASCII 32 to ASCII 126.  Extended character
  1400. codes, such as cursor keys are not passed to the
  1401. filter.
  1402.  
  1403.   List:
  1404.   
  1405. A list box displays a list of options.  The user can
  1406. navigate through the list using mouse or keyboard.
  1407. Lists can be of either horizontal or vertical
  1408. orientation, with scroll bars.
  1409.  
  1410.      _dbox_c_list( dbox, control, xpos, ypos, xsize,
  1411.         ysize, fieldsize, orientation, titletext, list,
  1412.         exitmode, select_function, highlight_function );
  1413.      
  1414. Xpos and ypos set the position of the first character
  1415. of the title text. The top left corner of the list box
  1416. is one character below this.
  1417.  
  1418. Xsize and ysize specify the internal dimensions of the
  1419. list box.
  1420.  
  1421. Fieldsize is used for horizontal lists where lists run
  1422. down the box until the bottom line is reached, and then
  1423. begin a new column to the right of the first.  Field
  1424. size specifies the column width in characters. Note
  1425. that the list is displayed with a single character
  1426. margin to the left of the first column, and the last
  1427. character of each field is blanked to  maintain
  1428. separation between columns.  Therefore, fieldsize
  1429. should be one greater than the length of the longest
  1430. item possible in the list if you do not want items to
  1431. be truncated.
  1432.  
  1433. The orientation parameter should be set to DBL_HSCROLL
  1434. for a horizontal list or DBL_VSCROLL for a vertical
  1435. list.
  1436.  
  1437. Horizontal lists display a number of columns of text.
  1438. Each column contains a number of items corresponding to
  1439. the ysize of the box.  The number of columns is then
  1440. dictated by the size of the list. A scroll bar at the
  1441. bottom of the box allows navigation through the list.
  1442.  
  1443. Vertical lists contain a single column, with a scroll
  1444. bar on the right hand edge.
  1445.  
  1446. Titletext is a pointer to a string which is displayed
  1447. as a title above the box.  It may contain an ampersand
  1448. to specify a hotkey.
  1449.  
  1450. List is a pointer to the list to be displayed in the
  1451. box.  This could be a pointer returned by the
  1452. _s_buildlist() function, as described elsewhere.
  1453.  
  1454. Exitmode is used as with button controls.  The exitmode
  1455. parameter can be set to EXIT or NOEXIT and specifies
  1456. whether the dialogue should close when a selection is
  1457. made.  ESCAPE is not valid for use with list boxes.
  1458.  
  1459. There are two functions that can be hooked to each
  1460. list.  These are the select_function and
  1461. highlight_function.  Each of these is a 'vfnptr' as
  1462. usual.  The select function is called when a selection
  1463. is made.  The  highlight function is called when the
  1464. list box highlight moves to a new item in the list.
  1465.  
  1466.   Combo box:
  1467.   
  1468. A combo box is similar to a vertical list, but displays
  1469. the current selection in a space more like a text box.
  1470. You can cycle through the  list of options using the
  1471. cursor keys.  The combo can be opened with the mouse by
  1472. pressing the open button, and a box, like a vertical
  1473. list pops up over the dialogue. The user can then
  1474. select from the list with the mouse or cursor keys.
  1475.  
  1476.      _dbox_c_combo( dbox, control, xpos, ypos, xsize,
  1477.         ysize, initial, titletext, list, exitflag,
  1478.         select_function, highlight_function );
  1479.      
  1480. Xpos and ypos specify the position of the beginning of
  1481. the title text. This is followed by a space of xsize.
  1482.  
  1483. Xsize and ysize also specify the size of the box that
  1484. will pop up when the combo is opened.
  1485.  
  1486. The initial parameter specifies the item which is
  1487. initially displayed.
  1488.  
  1489. Titletext and list specify the title and contents of
  1490. the list, as for the list box above.  select_function
  1491. and highlight_function operate in exactly the same way
  1492. as for the list box.
  1493.  
  1494.   Reading and writing the data in a dialogue.
  1495.   
  1496. Your program will need to access the data stored in a
  1497. dialogue.  The program may also need to change this
  1498. data, for example to change the contents of a list.
  1499.  
  1500. To do this you need to access structure members in
  1501.  
  1502.      _dbox[dbox].control[cnum]
  1503.      
  1504. where dbox specifies the dialogue box, and cnum is the
  1505. control number in that dialogue box.
  1506.  
  1507. _dbox[dbox].control[cnum].iret is an integer that
  1508. stores integer return values from controls.  It will be
  1509. referred to in the following simply as iret:
  1510.  
  1511.      _dbox[dbox].control[cnum].iret
  1512.      
  1513.   Buttons:
  1514.   
  1515. If a button has been pressed one or more times since
  1516. the dialogue was opened, then iret will be set to TRUE.
  1517. Otherwise, iret will be FALSE.
  1518.  
  1519.   Check boxes:
  1520.   
  1521. If the box is checked, iret will be TRUE.  If the box
  1522. is not checked, iret will be FALSE.  The program can
  1523. change iret to change the data  stored in the check
  1524. box.
  1525.  
  1526.   Radio buttons:
  1527.   
  1528. Iret will be the number of the radio button that is
  1529. currently selected.  The first button is zero, and they
  1530. are numbered in the order in which they were defined in
  1531. the list that was passed to _dbox_c_radio().  The
  1532. program can set iret to change the selected item.
  1533.  
  1534.   Text boxes:
  1535.   
  1536. Iret is not used with text boxes.  The text string is
  1537. stored in an area of dynamically allocated memory and a
  1538. pointer to that buffer is held in the variable
  1539. _dbox[dbox].control[control].bret .
  1540.  
  1541. You should never assume that this pointer remains
  1542. constant, since it may be changed by Steph even if the
  1543. text in the box has not been edited.
  1544.  
  1545. You can change the text by making this pointer point to
  1546. the new string.  You should ensure that the pointer
  1547. points to dynamically allocated text, or the system is
  1548. liable to crash while editing.  You may free() the old
  1549. text if it is no longer required.
  1550.  
  1551.   List boxes:
  1552.   
  1553. List boxes use both iret and bret (see text boxes,
  1554. above).  Iret stores the number of the currently
  1555. selected item in the list.  It can be interrogated or
  1556. set by the program.  The items in the list are numbered
  1557. beginning at zero.
  1558.  
  1559. A variable similar to iret is an integer (int) called
  1560. inf3 and is accessed in the same way:
  1561.  
  1562. _dbox[dbox].control[cnum].inf3 .
  1563.  
  1564. The inf3 variable stores the start position for the list:
  1565. A column number for horizontal lists, and an item number
  1566. for vertical lists.  That is, it contains the column number
  1567. of the leftmost column, or the topmost item that is visible
  1568. in the list box.
  1569.  
  1570. Bret is a pointer to a dynamically allocated buffer
  1571. that contains a list such as one built by
  1572. _s_buildlist().  This defines the list that will
  1573. appear in the list box.  You can change the list by
  1574. making this  pointer point to a new list, remembering
  1575. to free() the old list if it is no longer required.
  1576.  
  1577. When you change bret to point to a new list, you should 
  1578. ensure that the current selection remains within the 
  1579. limits of the new list.  For example, if the highlight
  1580. is on item five of a long list, and you then change the
  1581. list to one containing only four items, the selection
  1582. will be invalid.
  1583.  
  1584. It is a sensible precaution therefore to zero both the
  1585. iret and inf3 variables when a list changes, thus ensuring
  1586. that the highlight remains on a valid item.  Use code such as:
  1587.  
  1588.      /* change the list in control 4, dialogue 0 */
  1589.      _dbox[0].control[4].bret = newlist;
  1590.      _dbox[0].control[4].iret = 0;
  1591.      _dbox[0].control[4].inf3 = 0;
  1592.  
  1593.   Combo boxes:
  1594.   
  1595. These use iret and bret in an identical way to list
  1596. boxes, as described above.
  1597.  
  1598. The inf3 variable is used differently in a combo box and
  1599. should not be altered.  As described below, a combo box
  1600. should not have it's contents changed while its dialogue
  1601. is open, so there is no need to change the starting item.
  1602.  
  1603. You should, however, reset the current item to zero when
  1604. changing the list in a combo box.  For example:
  1605.  
  1606.      /* change the contents of a combo box */
  1607.      _dbox[0].control[8].bret = newlist;
  1608.      _dbox[0].control[8].iret = 0;
  1609.  
  1610.   Labels:
  1611.  
  1612. You can change the text displayed on a label control by 
  1613. manipulating a variable called init.  For example:
  1614.  
  1615.      /* change a label */
  1616.      _dbox[0].control[2].init = "New String!";
  1617.  
  1618. If the new string is shorter than the old one, you should
  1619. add a number of spaces to the end of the new string to
  1620. ensure that the old one is fully overwritten.
  1621.  
  1622.   Frames:
  1623.   
  1624. Frames are not interactive so clearly the
  1625. values of iret and bret that they return are
  1626. meaningless.
  1627.  
  1628.   Updating and redrawing controls.
  1629.   
  1630. If your program needs to change the data stored in a
  1631. control, it is simplest to do it while the dialogue box
  1632. is off the screen.  There will however be a number of
  1633. occasions where the user's interaction with one control
  1634. will require the data in another to change, with the
  1635. dialogue box displayed on the screen all the time.
  1636.  
  1637. You can change a control by writing to the data variables
  1638. as described in the above section.
  1639.  
  1640. Steph cannot tell if data has been changed in this way,
  1641. so it is up to the user to control the redrawing of the
  1642. controls that have changed.  The function
  1643. _db_draw_control() is used to do this:
  1644.  
  1645.      _dbox_draw_control( dbox, control );
  1646.      
  1647. Where dbox specifies the dialogue box, and control
  1648. specifies the control that must be redrawn.
  1649.  
  1650.   Greyness.
  1651.   
  1652. Sometimes you will want to make certain controls on a
  1653. dialogue unavailable. Greyness refers to the fact that
  1654. controls made unavailable in this way are drawn in grey
  1655. rather than the black ink used for active controls
  1656. (assuming the default colour scheme).
  1657.  
  1658. To change the greyness of a control you use the
  1659. function _dbox_grey():
  1660.  
  1661.      _dbox_grey( dbox, control, radioitem, greyness );
  1662.      
  1663. Where dbox specifies the dialogue, and control the
  1664. number of the control to be changed.  If the control is
  1665. a set of radio buttons, then the parameter radioitem
  1666. specifies the individual button to be changed.  The
  1667. radioitem parameter is ignored if the control is not a
  1668. set of radio buttons.
  1669.  
  1670. The parameter greyness determines what the greyness of
  1671. the control will be set to.  It should be set to either
  1672. GREY or NOTGREY.
  1673.  
  1674. If the dialogue is open when the greyness is changed,
  1675. then the relevant controls should be redrawn using the
  1676. _dbox_draw_control() function.
  1677.  
  1678.   Overriding a control's exit mode.
  1679.  
  1680. Buttons, list boxes and combo boxes have an 'exit mode',
  1681. described above, which determines whether the dialogue will
  1682. remain open or close down when the button is pressed, or a 
  1683. selection made from the list.  Moving the highlight does not
  1684. constitute a selection being made from a list or combo box.
  1685.  
  1686. There are situations where you will want to override the 
  1687. exit mode of a control.  To take a simple example, imagine
  1688. an 'OK' button at the bottom of a dialogue.  The user 
  1689. presses this button when they are happy with the data in
  1690. the dialogue and want to proceed with the operation...
  1691.  
  1692. The user presses the 'OK' button, and if all is well, the
  1693. button's hook function performs the operation which is
  1694. required.  The button's exitmode is EXIT, so the dialogue
  1695. closes.
  1696.  
  1697. Now suppose that the data in the dialogue is incorrect.
  1698. The 'OK' button's hook function detects this, and rather
  1699. than closing the dialogue it beeps and keeps the dialogue
  1700. open so that you can correct you mistake.
  1701.  
  1702. How is this done?
  1703.  
  1704. Steph uses a variable in the _dbox_spec global structure to
  1705. pass a return value from each control to the dialogue box
  1706. manager.  The variable is called _ca_ret and can be
  1707. accessed using:
  1708.  
  1709.      _dbox_spec._ca_ret = value;
  1710.  
  1711. or
  1712.  
  1713.      variable = _dbox_spec._ca_ret;
  1714.  
  1715. When the 'select' function for a control (button, list or
  1716. combo) is being called, the _ca_ret variable has already
  1717. been set according to the exit mode of the control.  
  1718. Possible values are:
  1719.  
  1720.   _CA_ESC           The exit mode is ESCAPE, and the
  1721.                     dialogue will close down restoring the
  1722.                     data to the on-entry state.
  1723.  
  1724.   _CA_EXIT          The exit mode is EXIT, and the dialogue
  1725.                     will close down leaving data intact.
  1726.  
  1727.   _CA_NOEXIT        The exit mode is NOEXIT.  The dialogue
  1728.                     will not close down when the control is 
  1729.                     'selected'.
  1730.  
  1731. The value is dependant entirely on the exit mode of the control.
  1732. If you want to override the default mode you simply write a new
  1733. value into the _ca_ret variable, depending on the behaviour you
  1734. want.  The exit mode is not changed permanently.  You should
  1735. write only one of the three constants listed above.  Any other
  1736. value will give unpredictable results.
  1737.  
  1738. For example:
  1739.  
  1740.      value = _dbox_spec._ca_ret;
  1741.      /* value == _CA_EXIT, but we want to override that */
  1742.  
  1743.      _dbox_spec._ca_ret = _CA_NOEXIT;
  1744.      /* the dialogue will no longer close when the select 
  1745.         function returns. */
  1746.  
  1747.   Dialogue box bars.
  1748.   
  1749. In order to improve the appearance of a dialogue, it is
  1750. sometimes useful to separate different parts with a
  1751. horizontal bar that runs across the box.  An example is
  1752. the bar which separates the text and buttons on a query
  1753. box.
  1754.  
  1755. A dialogue can have up to four such bars.  Their
  1756. positions on the dialogue are defined using the
  1757. function _dbox_setbars():
  1758.  
  1759.      _dbox_setbars( dbox, bar1, ... );
  1760.      
  1761. This function takes a variable number of parameters.
  1762. The first is the number of the dialogue that the bars
  1763. will be added to.
  1764.  
  1765. The list of parameters that follow is a list of up to
  1766. four y positions, measured relative to the top of the
  1767. dialogue.  For example:
  1768.  
  1769.      _dbox_setbars( 0, 5, 10, 15, 17 );
  1770.      
  1771. would set horizontal bars on dialogue zero at five,
  1772. ten, fifteen and seventeen characters from the top of
  1773. the box.
  1774.  
  1775. If fewer than four bars are required, the list can be
  1776. terminated with the parameter _NO_BAR:
  1777.  
  1778.      _dbox_setbars( 0, 5, _NO_BAR );
  1779.      
  1780. would set a single bar, five characters below the top
  1781. of dialogue zero.
  1782.  
  1783.   Dependency.
  1784.   
  1785. When the user presses ESC in a dialogue box, or when a
  1786. button with the exitmode set to ESCAPE is pressed, the
  1787. data in the dialogue box is restored to the values that
  1788. were held on entry.
  1789.  
  1790. If, for example, a button on your first dialogue opens
  1791. a second dialogue, you may want the data in both
  1792. dialogues to be restored if ESC is pressed in the
  1793. first.  In order to have this happen you can set your
  1794. second dialogue to be a dependant of the first:
  1795.  
  1796.      _dbox_setdependants( dbox, dependant1, ... );
  1797.      
  1798. The first parameter is the number of the dialogue for
  1799. which dependants are to be defined.  A dialogue may
  1800. have up to sixteen dependants.  These are  listed in
  1801. the variable length parameter list, with the constant
  1802. _NO_DEPENDANT used to terminate the list in a similar
  1803. way to the list of parameters passed to
  1804. _dbox_setbars().
  1805.  
  1806. Note that when the user presses ESC, the data is reset
  1807. only in those dialogues listed in the dependants list
  1808. for the current box.  If a dependant of the current box
  1809. has dependants of its own, the data in these dialogues
  1810. will not be reset, unless they are also defined as
  1811. dependants of the first dialogue box.
  1812.  
  1813. The behaviour of List and Combo controls should be
  1814. explained more fully now.  You will notice that the
  1815. contents of a list box are not reset by the user
  1816. pressing ESC.  This is because the contents of a list
  1817. box are liable to change often whilst the dialogue is
  1818. open.  The list stored in a combo box is assumed not to
  1819. change, at least while the dialogue is on the screen.
  1820. This means that Steph will restore the selection in a
  1821. combo when the user presses ESC.
  1822.  
  1823. To summarise:
  1824.  
  1825. List Box:   List and selection are not reset by ESC.
  1826.             List may be changed while dialogue is open.
  1827.             You should zero iret and inf3 to move the
  1828.             highlight to the start of the new list.
  1829.  
  1830. Combo Box:  Selection is reset by ESC.  List should
  1831.             never be changed while dialogue is open.
  1832.             You should zero iret when changing the 
  1833.             list at other times.
  1834.  
  1835.   Dialogue box global keys.
  1836.  
  1837. Just as you define keyboard filter and action functions
  1838. for a window, so you can do for a dialogue box.  This
  1839. filter will operate on all keystrokes made while that
  1840. dialogue is on the screen, regardless of which control
  1841. is active.
  1842.  
  1843. When a key is pressed it is examined by the current
  1844. control, which will act on it if appropriate.  The key
  1845. is then passed to the global key filter, whether the
  1846. key was used by the control or not.  It is therefore
  1847. possible for a keystroke to trigger two events, one in
  1848. the control and one in the global keystroke action
  1849. function.  This is not normally desirable, so you
  1850. should ensure that the keys that your global key filter
  1851. will pass are not meaningful to the controls.  A
  1852. typical use of the global key filter is to cause extra
  1853. information to be displayed when F1 (for help) is
  1854. pressed.
  1855.  
  1856. Global filter and action functions are attached to a
  1857. dialogue using:
  1858.  
  1859.      _dbox_set_global_keys( dbox, filter, action );
  1860.  
  1861. Where dbox specifies the dialogue box, and filter and
  1862. action are pointers the the filter and action
  1863. functions.
  1864.  
  1865. The filter function is similar to the window filter
  1866. functions in that the keystroke information must be
  1867. read from two variables.  Those variables are:
  1868.  
  1869.      _dbox_spec.filter_key
  1870.      _dbox_spec.filter_key2
  1871.  
  1872. Where filter_key contains either the ASCII code, or
  1873. zero, and filter_key2 contains either zero or the scan
  1874. code of the key.  One of the variables will contain
  1875. information and the other will contain zero, depending
  1876. on whether the keystroke translates into an ASCII code
  1877. or not.
  1878.  
  1879. In order to pass the keystroke the function must leave
  1880. the values in these two variables intact.  They will
  1881. remain there so that the action function can read them
  1882. too.  If the key is not to be passed then both
  1883. variables should be set to zero.
  1884.  
  1885. Query Boxes.
  1886.  
  1887. A query box is a derivative of dialogue boxes.  Queries
  1888. are not built in the same way as dialogue boxes before
  1889. they are used, instead the _query_box() function is
  1890. called which defines and opens the box.
  1891.  
  1892. A query box contains only text and buttons.  For
  1893. example, the text may ask 'Do you want to continue?'
  1894. and the buttons will be 'Yes' and 'No'. A query box is
  1895. opened with:
  1896.  
  1897.      button = _query_box( position, textlist,
  1898.         buttonlist, helptext );
  1899.      
  1900. The position parameter can be either CENSCR or CENWIN,
  1901. to centre the query on the screen or on the currently
  1902. active window.
  1903.  
  1904. Textlist is a pointer to a list containing the lines of
  1905. text that will appear in the query.  This can be
  1906. defined using _s_buildlist() in the same way as for
  1907. the text that appears in a flash box.
  1908.  
  1909. Buttonlist is a pointer to a similar list, but this one
  1910. contains a list of texts, with ampersands to define
  1911. hotkeys if necessary, which will appear as the row of
  1912. buttons below the text.
  1913.  
  1914. Helptext is a pointer to the string that appears on the
  1915. speed bar while the  query is on the screen.
  1916.  
  1917. The function returns the number of the button that was
  1918. pressed.  Numbering begins with zero, and increases
  1919. from left to right across the box, in the order that
  1920. the buttons were defined in the buttonlist.  If the
  1921. query was exited with the ESC key, the function will
  1922. return the constant QB_NONE.
  1923.  
  1924.   Using Dialogue Boxes.
  1925.  
  1926.   Mouse.
  1927.  
  1928. Most users prefer to use the mouse to control dialogue
  1929. boxes.  Control is fairly intuitive:  Buttons can be
  1930. pressed by clicking the mouse over them.  Radio buttons
  1931. can be selected and check boxes toggled in a similar
  1932. way.  All controls are made active by clicking the
  1933. mouse over them.
  1934.  
  1935. Text boxes can be selected by clicking the mouse in the
  1936. text area:  If the text box was the active control the
  1937. mouse will place the cursor within the text, if not,
  1938. the text box becomes active and the text is
  1939. highlighted.
  1940.  
  1941. A combo box can be opened by pressing the open button.
  1942. When open it behaves much like a list box.  An open
  1943. combo box closes automatically when another control is
  1944. selected.
  1945.  
  1946. An item in a list box can be highlighted by clicking
  1947. over it.  Double clicking, or 'selecting' is
  1948. considered a seperate event by Steph.  The highlight
  1949. can be dragged by holding the mouse button down.  The
  1950. list can be made to scroll by dragging the cursor
  1951. outside the list box.  Scrolling can also be achieved
  1952. by clicking on the scroll bar or by dragging the scroll
  1953. bar blip.
  1954.  
  1955.   Keyboard.
  1956.  
  1957. The controls in a dialogue box can be operated entirely
  1958. by the keyboard.  Combo boxes can be used, but cannot
  1959. be popped open without a mouse.  Toolbar buttons and
  1960. combo boxes, although derived from dialogue controls
  1961. cannot be activated without a mouse.
  1962.  
  1963. To navigate about the dialogue box, the TAB key is
  1964. used.  This cycles through the controls in order,
  1965. activating each in turn.  To cycle backwards the SHIFT-
  1966. TAB combination is used.  Controls will only react to
  1967. the user when active.  You can move straight to a
  1968. control by pressing the ALT key with the highlighted
  1969. hotkey for that control.
  1970.  
  1971. Buttons can be pressed by hitting either the RETURN key
  1972. or the space bar.  Check boxes can be toggled by
  1973. pressing the space bar, and pressing RETURN has the
  1974. effect of closing down the dialogue.
  1975.  
  1976. The cursor keys are used to cycle through the options
  1977. in a set of radio buttons.  Again, pressing return
  1978. closes down the dialogue.
  1979.  
  1980. Text boxes accept text when it is typed at the
  1981. keyboard.  The insert or overtype mode can be toggled
  1982. with the INS key.  Backspace and DEL delete the
  1983. character before or under the cursor respectively.  The
  1984. cursor keys move the cursor through the text, scrolling
  1985. the box if necessary.  Holding down the shift key when
  1986. moving the cursor will highlight a range of characters
  1987. which can then be deleted or typed over.  HOME and END
  1988. keys move to the start or end of the text respectively.
  1989.  
  1990. The highlight is moved through list boxes with the
  1991. cursor keys, scrolling if necessary as it goes.
  1992. Pressing RETURN selects an item from the list.
  1993. Pressing an alphanumeric key will move the highlight to
  1994. the next item in the list which begins with that
  1995. character.  HOME, END, PGUP and PGDN can be used to
  1996. move more rapidly through long lists.
  1997.  
  1998. Combo boxes behave just like vertical list boxes.  When
  1999. a combo is closed only the highlighted item can be seen
  2000. in the window.  If the box has been opened with the
  2001. mouse the whole list will be visible.
  2002.  
  2003. The ESC key can be pressed at any time to leave the
  2004. dialogue, restoring the data to the state it was when
  2005. the box was opened.  Data is also restored in any
  2006. dependant dialogue boxes.
  2007.  
  2008.  
  2009. More things to do with windows.
  2010.  
  2011.   Opening, closing, resizing etc.
  2012.   
  2013. Steph provides the programmer with the ability to open
  2014. and close windows from the application code.  Windows
  2015. can also be resized, activated, etc.
  2016.  
  2017. When you need to open a new window, or close one, this
  2018. can be achieved from the application code:
  2019.  
  2020.      _window_open( window, open );
  2021.      
  2022. Where window is the number of a previously built
  2023. window, and open is a constant which may be OPEN or
  2024. CLOSED, to specify what is to be done to the window in
  2025. question.
  2026.  
  2027. To change the active window, you use the function:
  2028.  
  2029.      _window_make_active( window );
  2030.      
  2031. Where window should be the number of a window which is
  2032. currently open on the screen.
  2033.  
  2034. You can maximise or minimise a window from the
  2035. application using the functions:
  2036.  
  2037.      _window_maximise( window );
  2038.      _window_minimise();
  2039.      
  2040. Where window specifies the window to be maximised.  If
  2041. a window is already maximised, the maximise function
  2042. will return having had no effect. The
  2043. _window_minimise() function takes no parameters, simply
  2044. minimising the window that is currently maximised, if
  2045. there is one.
  2046.  
  2047. To change the size of a window use the function:
  2048.  
  2049.      _window_size( window, against, rows );
  2050.      
  2051. This function takes three parameters.  Window specifies
  2052. the number of the window that is to be resized.
  2053. Attempting to size window zero (the main window) will
  2054. have no effect since this window expands to fill the
  2055. space left when all other windows have been drawn.  The
  2056. rows parameter specifies the new size of the window.
  2057. The against parameter specifies the number of the
  2058. window from which lines will be removed or added to
  2059. balance the change in size of the window being resized
  2060. - the against window must be open on the screen at the
  2061. time the function is called.
  2062.  
  2063. The function checks to ensure that the new size will
  2064. fit on the screen, resizes the window and returns TRUE
  2065. to indicate success.  If the requested size change
  2066. could not be accommodated, the function will return
  2067. FALSE. The function will also fail if a window is
  2068. currently maximised.
  2069.  
  2070.   Redrawing and refreshing windows.
  2071.   
  2072. When you have finished opening, closing, and sizing
  2073. windows, you will notice that nothing has happened on
  2074. the screen.  In order to redraw the windows you must
  2075. call the function:
  2076.  
  2077.      _window_draw();
  2078.      
  2079. Which will redraw all the borders, titles, scroll bars
  2080. and controls.  This function does not redraw the
  2081. contents of the windows, as this can sometimes take a
  2082. few moments and you may like to optimise the process by
  2083. refreshing only those parts of those windows that
  2084. require it.
  2085.  
  2086. You can redraw a window's contents with:
  2087.  
  2088.      _window_refresh( window );
  2089.      
  2090. Or you can refresh all the visible windows using:
  2091.  
  2092.      _window_refresh_all();
  2093.      
  2094. If you simply want to blank a window, leaving the
  2095. contents buffer intact, use the function:
  2096.  
  2097.      _window_clear( window );
  2098.      
  2099. When only some lines on a window have changed, you can
  2100. optimise the refresh by using the function:
  2101.  
  2102.      _window_lines_refresh( window, startline, endline,
  2103.         dofixed );
  2104.      
  2105. Window is the number of the window to be refreshed, and
  2106. startline and endline specify the range of lines from
  2107. the contents buffer to be refreshed.  The dofixed
  2108. parameter is useful if a window has a number of fixed
  2109. lines at the top, and it should be set to TRUE if those
  2110. lines are to be refreshed.
  2111.  
  2112.   The window contents list.
  2113.   
  2114. The contents of a window are stored in a linked list.
  2115. Each element in the list describes one line of the
  2116. contents of the window.  Each window is created with an
  2117. empty contents list.
  2118.  
  2119. The system maintains a pointer to the current 'line' in
  2120. the list.  All operations act on the current line.
  2121.  
  2122. To insert a new line into the list, at the current
  2123. position use:
  2124.  
  2125.      _wb_newline( window );
  2126.      
  2127. The window parameter is necessary to specify the list
  2128. that you wish to add to. Each window owns one list.
  2129. The new line is created empty, and is inserted into the
  2130. contents list at the current position.
  2131.  
  2132. Similarly, to remove the current line from the list use
  2133. the function:
  2134.  
  2135.      _wb_delline( window );
  2136.      
  2137. If the line thus deleted contained a text, the text
  2138. will be deleted and the memory that it used will be
  2139. free'd.
  2140.  
  2141. Once a number of lines have been defined, you can move
  2142. between them using:
  2143.  
  2144.      _wb_gotoline( window, linenumber );
  2145.      
  2146. Where window specifies the list belonging to a
  2147. particular window, and linenumber specifies the line.
  2148. The first line is line number zero.
  2149.  
  2150. To set the text stored in the current line, use:
  2151.  
  2152.      _wb_settext( window, linetext );
  2153.      
  2154. Where linetext is a pointer to a text string, which
  2155. must be stored in dynamically allocated memory.  The
  2156. strdup function can be used to make a dynamic copy of a
  2157. string.
  2158.  
  2159. The contents of the window contents list will be
  2160. displayed in the window when it is refreshed with one
  2161. of the _window_refresh() functions.
  2162.  
  2163. Steph allows a further piece of information to be
  2164. stored with each buffer line.  These are called
  2165. endcodes, and take the form of int values which are
  2166. stored in the linked list.  Endcodes can be put to any
  2167. use by the  programmer:  As a typical example, consider
  2168. a window that contains a text editor in which long
  2169. lines are 'word wrapped'.  The editor will need to
  2170. distinguish between lines that have been wrapped, and
  2171. lines that end with a carriage return.  It may also be
  2172. necessary to mark the last line in the document, or to
  2173. include formatting codes.  If this or any other
  2174. information can be encoded into a single integer value,
  2175. it can be stored as an endcode.
  2176.  
  2177. Endcodes are set and read for the current line using
  2178. the functions _wb_setend and _wb_getend, as described
  2179. in the reference section below.
  2180.  
  2181. Note that the endcode information is not used by Steph,
  2182. so the value will have no effect on, for example, the
  2183. display of window contents on the screen.  Endcodes are
  2184. provided merely as a means of attaching data to a
  2185. window buffer on a line-by-line basis, and their
  2186. implementation is left to the programmer.
  2187.  
  2188.   Fixed lines.
  2189.   
  2190. Steph allows a number of lines from the beginning of
  2191. the contents list to be permanently displayed at the
  2192. top of a window, regardless of the line offset value
  2193. stored in the _window[].lineo variable.  This is
  2194. similar to the feature which allows the top rows of
  2195. many spreadsheets to be locked - displaying column
  2196. headings at the top of the screen.  The feature might
  2197. alternatively be used to provide a ruler line in a word
  2198. processor.
  2199.  
  2200. The _window_setfixed() function is used to set the
  2201. number of lines which are to be fixed at the top of a
  2202. particular window:
  2203.  
  2204.      _window_setfixed( window, fixed_lines );
  2205.      
  2206. Suppose this call was made with fixed_lines equal to
  2207. three:  The top three lines of the window, when
  2208. displayed, will show lines 0, 1, and 2 from the
  2209. contents list for that window.  Normal display will
  2210. begin with the line specified by _window[].lineo, on
  2211. the fourth line of the window.
  2212.  
  2213. Notice that if, for example, the number of fixed lines
  2214. is three, and the line offset for the window is set to
  2215. zero, the first three lines from the contents list will
  2216. appear twice:  Once in the fixed lines, and again
  2217. below, in the main body of the window.  It is the
  2218. responsibility of the programmer to avoid such a
  2219. situation (by setting the line offset appropriately) if
  2220. this is deemed undesirable.
  2221.  
  2222.   Window redraw modes and the redraw function.
  2223.   
  2224. The discussion above has assumed that windows are in
  2225. the standard mode. That is, they contain text with
  2226. constant foreground and background colours which is
  2227. defined in a linked list as described.
  2228.  
  2229. There are, in fact, four modes which can be used.  The
  2230. behaviour of the window is different in each case.
  2231.  
  2232. Mode      Description
  2233. WD_AUTO   The standard mode as described above.
  2234. WD_COLOUR A mode allowing greater flexibility in the use
  2235.           of colour.
  2236. WD_CLEAR  A mode where the window is cleared but not
  2237.           redrawn.
  2238. WD_USER   A mode where the user has total redraw control.
  2239.  
  2240. Windows are set into one of these four modes using the
  2241. function:
  2242.  
  2243.      _window_set_draw( window, drawmode, draw_func );
  2244.      
  2245. Where window is the number of the window whose draw
  2246. mode is to be changed, drawmode is one of the four
  2247. constants listed above, to specify the new mode for
  2248. that window, and draw_func is a 'vfnptr' pointer to a
  2249. function which will be called each time that window is
  2250. refreshed.
  2251.  
  2252. The draw_func function can contain code for redrawing
  2253. the window, or it may contain any other code that
  2254. should be run when the window is refreshed.  The
  2255. draw_func function is always called after any built in
  2256. refresh operations which are applicable to the current
  2257. window mode.
  2258.  
  2259.   The WD_AUTO mode.
  2260.   
  2261. AUTO mode is the default mode.  Windows are
  2262. automatically placed into this mode when they are
  2263. built.  The window contents are provided in the window
  2264. contents buffer as described previously, and the window
  2265. has fixed background and foreground colours.
  2266. Characters from the entire Extended ASCII character set
  2267. may be displayed.  The draw_func function is called
  2268. when the window has been refreshed.
  2269.  
  2270.   The WD_COLOUR mode.
  2271.   
  2272. This mode is identical to the AUTO mode, but allows
  2273. colour codes to be  inserted into the lines.  In the
  2274. absence of colour codes, the mode appears identical to
  2275. AUTO mode.  The functions for manipulating colour codes
  2276. are described below.  The draw_func function is called
  2277. when the window has been refreshed.
  2278.  
  2279.   The WD_CLEAR mode.
  2280.   
  2281. This mode clears the window to the background colour
  2282. when refreshed, but does not attempt to display the
  2283. window contents.  The draw_func function is called when
  2284. the window has been cleared, and is responsible for any
  2285. further display that is required.
  2286.  
  2287.   The WD_AUTO mode.
  2288.   
  2289. This mode places the entire responsibility for
  2290. refreshing the window on the draw_func function.  It is
  2291. particularly useful when running Steph in a graphics
  2292. mode.  A discussion of graphics mode operation can be
  2293. found elsewhere.
  2294.  
  2295.   Colouring functions for WD_COLOUR mode.
  2296.   
  2297. Steph provides a number of functions for the
  2298. manipulation of colour codes in the window contents
  2299. list.
  2300.  
  2301. Colours are specified as paper and ink colours for
  2302. individual character squares.  There will be sixteen
  2303. foreground colours available, and either eight or
  2304. sixteen background colours.  Where eight background
  2305. colours are available those numbered from 8 to 15 will
  2306. give flashing colours.  Most video systems can be
  2307. switched to give either eight background colours plus
  2308. flashing colours, or sixteen steady colours.
  2309.  
  2310. To set the colours of a range of characters, use:
  2311.  
  2312.      _wbcc_setcolour( window, sline, schar, eline,
  2313.         echar, ink, paper );
  2314.      
  2315. Where window specifies the window whose contents are to
  2316. be coloured. Sline and schar specify the line and
  2317. character position on that line of the first character
  2318. to be coloured.  Similarly eline and echar specify the
  2319. line and character position within that line of the
  2320. last character to be coloured.  Ink and paper give the
  2321. foreground and background colours respectively.
  2322.  
  2323. If a character has not had its colour specifically set,
  2324. it will be displayed in the default colours for that
  2325. window.
  2326.  
  2327. To remove all colour codes from a line, use:
  2328.  
  2329.      _wbcc_uncolour( window, line );
  2330.      
  2331. Which will restore the whole line to the default colour
  2332. scheme.
  2333.  
  2334. These two functions give control over the colours of
  2335. all characters in the contents list.  Now, suppose a
  2336. window contains help text.  The user clicks the mouse
  2337. on the window and you want to know if the click
  2338. corresponds to a word which has been highlighted as a
  2339. link to another subject.  You can use the
  2340. _wbcc_getcolour function to determine the colours of a
  2341. particular character, and hence determine whether that
  2342. character is part of a highlighted word:
  2343.  
  2344.      _wbcc_getcolour( window, line, qchar, ink,
  2345.         paper );
  2346.      
  2347. In this call, window specifies the window in question,
  2348. and line and qchar  are used to specify the line and
  2349. character position within that line for which colour
  2350. information is required.  The ink and paper parameters
  2351. are pointers to short integer variables in which the
  2352. colour data is to be returned.
  2353.  
  2354. For example:
  2355.  
  2356.      /* Read colours of character 0 on line 3 of window 0 */
  2357.      
  2358.      short ink, paper;
  2359.      _wbcc_getcolour( 0, 3, 0, &ink, &paper );
  2360.      
  2361.      /* Ink and paper now contain the colour values */
  2362.      
  2363.   Details of colour code storage in WD_COLOUR mode.
  2364.   
  2365. If you wish to have greater control of the colour
  2366. codes, you can insert the codes into the contents
  2367. buffers yourself.
  2368.  
  2369. A colour code consists of three bytes (characters) of
  2370. information.  The first character is the colour code
  2371. character, which is defined in the constant _WD_CCODE.
  2372. The next two characters are character values between 1
  2373. and 16 which indicate the colours of ink and paper
  2374. respectively. Alternatively, if all three bytes of the
  2375. colour code are _WD_CCODE, this indicates the default
  2376. colours for the window.
  2377.  
  2378. Note that the colour values for ink and paper are in
  2379. the range 1 to 16, rather than 0 to 15, which is the
  2380. usual coding system.  The colour value is simply
  2381. obtained by adding one to the colour number in the 0 to
  2382. 15 range. This is done to avoid the occurrence of a
  2383. zero character which would be confused for the end of
  2384. the string.
  2385.  
  2386. Colour codes apply up to the end of the line, or until
  2387. another code is encountered.  At the beginning of a new
  2388. line the default colours apply, until the first colour
  2389. code is found.  Note that Steph makes a distinction
  2390. between default colours, set by either the beginning of
  2391. a line, or a colour code consisting of three _WD_CCODE
  2392. characters, and a colour scheme which may appear
  2393. identical, but which was set using a _WD_CCODE
  2394. character followed by  two colour values.
  2395.  
  2396. The Speed Bar.
  2397.  
  2398.   Text display on the speed bar.
  2399.   
  2400. The speed bar is the lowest line of the screen.  It
  2401. automatically  displays help text when menus or
  2402. dialogue boxes are in use.
  2403.  
  2404. At all other times the speed bar displays a predefined
  2405. string.  This string is set using:
  2406.  
  2407.      _speed_setbar( bartext );
  2408.      
  2409. where bartext is a pointer to the string to be
  2410. displayed.  If any speed bar buttons are defined they
  2411. are painted over the text.  Buttons appear only over
  2412. the default text, and are disabled when a help text or
  2413. message is displayed.  If, at any time, you need to
  2414. display a message on the speed bar you can use:
  2415.  
  2416.      _speed_text( bartext );
  2417.      
  2418. where bartext is a pointer to the text.  You must
  2419. redraw the default text when your message is finished
  2420. with by calling the function:
  2421.  
  2422.      _speed_show();
  2423.      
  2424. A structure member _speed_spec.isdef is used to
  2425. indicate whether the speed bar is displaying the
  2426. default text as displayed with _speed_show(), in which
  2427. case it will be set to TRUE.  If the speed bar has been
  2428. displayed with _speed_text() or _speed_wipe() (see
  2429. later) then _speed_spec.isdef will be set to FALSE.
  2430.  
  2431. It may be necessary to attach a function to the speed
  2432. bar drawing operation. This is done using the
  2433. _set_speedbar_drawfn() function.
  2434.  
  2435.      _speed_drawfn( function );
  2436.      
  2437. This is used to attach a standard 'vfnptr' function to
  2438. the event of redrawing the speed bar.  It is called
  2439. when _speed_show() is used to redraw the speed bar.
  2440. Note that the Steph system makes calls to _speed_show()
  2441. in addition to those made by the user.  You might
  2442. typically use this function to add extra information to
  2443. the speed bar, such as caps-lock, num-lock and overtype
  2444. status in a text editor.
  2445.  
  2446. The speed bar can be made to respond to mouse clicks:
  2447.  
  2448.      _speed_clickfn( function );
  2449.      
  2450. This function is called when any mouse click is made on
  2451. the speed bar.  If buttons are visible on the speed
  2452. bar, the clickfn is called only when the mouse is
  2453. clicked on the speed bar but not over one of those
  2454. buttons.
  2455.  
  2456. A further function _speed_wipebar() can be called to
  2457. clear the speed bar completely.
  2458.  
  2459.   Adding buttons to the speed bar.
  2460.   
  2461. In addition to help messages and text, the speed bar
  2462. can be set up with a number of pressable buttons.  When
  2463. buttons are defined they appear at the same time as the
  2464. default text, and are masked when help texts are shown.
  2465.  
  2466. The system maintains a list of the speed bar buttons,
  2467. numbered from 0 up to a maximum of 15.  The buttons in
  2468. the list are displayed from left to right across the
  2469. speed bar.
  2470.  
  2471. Buttons are added to the list using:
  2472.  
  2473.      _speed_button( button_number, text, chevron,
  2474.         button_function ;
  2475.      
  2476. where button_number is the position in the list where
  2477. the button is to appear. The text parameter is a
  2478. pointer to a string containing the text that will be
  2479. displayed on the button.  By setting chevron to TRUE
  2480. the button text will appear within <chevrons> or angled
  2481. brackets.  Setting chevron to FALSE displays the button
  2482. without chevrons.  A function is attached to the button
  2483. by passing a standard void function pointer in
  2484. button_function.  This function will be called each
  2485. time the button is pressed.
  2486.  
  2487. When Steph comes to an undefined button, that is
  2488. treated as the end of the list.  For this reason you
  2489. should ensure that all your buttons are numbered from
  2490. zero upwards, without gaps.
  2491.  
  2492. By default, buttons take the colour of the speed bar.
  2493. They can be given different colours using the function:
  2494.  
  2495.      _speed_button_colour( button_number, ink, paper );
  2496.      
  2497. Where button_number identifies the button, and ink and
  2498. paper the colours to be used.
  2499.  
  2500. Buttons can be removed from the list using:
  2501.  
  2502.      _speed_button_remove( button_number );
  2503.      
  2504. You should be aware that this function will leave an
  2505. undefined button, which will be treated as the end of
  2506. the list unless the position is filled.
  2507.  
  2508. Speed bar buttons are often used to indicate a keyboard
  2509. shortcut.  For example, a button might appear as
  2510. <F1=Help> or <ALT=Menu>.  The hook function for
  2511. <F1=Help> would activate a help system.  A special
  2512. function is provided which can activate the menu
  2513. system.  It opens the leftmost menu automatically:
  2514.  
  2515.      _menu_go();
  2516.      
  2517. The Tool Bar.
  2518.  
  2519.   Reserving a toolbar.
  2520.   
  2521. The tool bar is an area at the top of the screen, just
  2522. below the menu bar, to which controls can be attached.
  2523. The controls can be buttons, toggle buttons and combo
  2524. boxes.  The tool bar is activated entirely by the mouse
  2525. - it cannot be operated by the keyboard alone.
  2526.  
  2527. Space for a toolbar is reserved before starting Steph
  2528. by calling the _toolbar_reserve() function.
  2529.  
  2530.      _toolbar_reserve( number_of_lines );
  2531.      
  2532. which will reserve number_of_lines for the tool bar.
  2533. The number of lines can be as large as four.  The tool
  2534. bars are then numbered from zero to three.
  2535.  
  2536.   Controls on the speed bar.
  2537.   
  2538. The easiest way to use the toolbar is to attach
  2539. controls to it.  Push buttons, toggle buttons and combo
  2540. boxes can all be attached.
  2541.  
  2542. Buttons are momentary devices, to which a function can
  2543. be attached.  The function is called every time the
  2544. mouse is clicked over the button.
  2545.  
  2546. Toggles are similar to buttons, but like light
  2547. switches, they change from one state to the other each
  2548. time they are clicked.  A different  function can be
  2549. attached to the 'turning on' and 'turning off' of the
  2550. toggle.
  2551.  
  2552. Combo boxes are identical to those which can be
  2553. incorporated into dialogue boxes.
  2554.  
  2555. Up to sixteen controls can be defined, numbered from
  2556. zero to fifteen. They are defined using the following
  2557. functions:
  2558.  
  2559.      _toolbar_set_button( control_number, bar,
  2560.         position, text, function );
  2561.      
  2562. This sets control number control_number to a button.
  2563. The button will appear on the tool bar line specified
  2564. in the bar parameter, starting at the column specified
  2565. by position.  The button text is stored in a string
  2566. pointed to by the text parameter, and function is a
  2567. pointer to a void function which will be called each
  2568. time the button is pressed.
  2569.  
  2570.      _toolbar_set_toggle( control_number, bar,
  2571.         position, text, initial, onfunction, offfunction );
  2572.      
  2573. This function sets control number control_number to a
  2574. toggle button.  The toggle will appear on the tool bar
  2575. line specified by the bar parameter, at the column
  2576. specified by position.  The toggle button text is
  2577. stored in a string  pointed to by text.
  2578.  
  2579. The initial parameter should be set to ON or OFF to
  2580. indicate the initial state of the toggle.  Onfunction
  2581. and offfunction are pointers to void functions.
  2582. Onfunction is called when the toggle switches from OFF
  2583. to ON, and offfunction is called when the toggle
  2584. switches from ON to OFF.
  2585.  
  2586.      _toolbar_set_combo( control_number, bar, position,
  2587.         xsize, ysize, text, list, initial, select_function );
  2588.      
  2589. This function sets control number control_number to a
  2590. combo box.  Bar and position specify the position of
  2591. the control on the tool bar, as above.  The xsize
  2592. parameter  defines the width of the data area of the
  2593. combo, and also the width of the pop-up list.  The
  2594. depth of the pop up list is defined by ysize.  The
  2595. title of the box is stored in a string pointed to by
  2596. text.
  2597.  
  2598. The list parameter is a pointer to a list containing
  2599. the data from which the combo box selection is made.
  2600. This list is of the same format as a list created by a
  2601. call to _s_buildlist().  Initial specifies which item
  2602. in the list is to be the current selection when the
  2603. combo first appears.
  2604.  
  2605. A void function is attached to the combo using the
  2606. select_function pointer.  This function is called when
  2607. a selection is made from the combo box.  Note that
  2608. toolbar combo boxes do not support a highlight
  2609. function.
  2610.  
  2611. A tool bar control can be redrawn using:
  2612.  
  2613.      _toolbar_draw_control( control_number );
  2614.      
  2615. Tool bar controls can be greyed as can dialogue box
  2616. controls.  The _toolbar_grey function is used:
  2617.  
  2618.      _toolbar_grey( control_number, greyness );
  2619.      
  2620. where control_number specifies the control to be
  2621. altered, and greyness is set to either GREY or NOTGREY.
  2622. Finally, a tool bar control can be removed using:
  2623.  
  2624.      _toolbar_remove_control( control_number );
  2625.      
  2626.   Displaying text on the toolbar.
  2627.   
  2628. Toolbar text can be also be displayed in a similar way
  2629. to the speed bar:
  2630.  
  2631.      _toolbar_set( bar_number, text );
  2632.      
  2633. will set the specified line of the toolbar to display
  2634. the text in the string pointed to by text.  A string
  2635. can be displayed on each reserved line in this manner.
  2636.  
  2637. The toolbar can be displayed or refreshed by calling:
  2638.  
  2639.      _toolbar_draw();
  2640.      
  2641. Note that if any controls are defined they will be
  2642. painted over this text.
  2643.  
  2644. The entire toolbar area can be blanked by calling:
  2645.  
  2646.      _toolbar_wipe();
  2647.      
  2648. Click and draw functions can be defined, which behave
  2649. in the same way as those for the speed bar.  They are
  2650. defined using the functions:
  2651.  
  2652.      _toolbar_clickfn( function );
  2653.      _toolbar_drawfn( function );
  2654.      
  2655. Pop up menus.
  2656.  
  2657. In addition to the menus that appear on the menu bar at
  2658. the top of the  screen, Steph provides pop up menus
  2659. that can be made to appear anywhere on the screen.  Up
  2660. to four pop up menus can be defined.  Like the main
  2661. menus they must be built before they can be used.
  2662.  
  2663. A pop up menu is built using the function:
  2664.  
  2665.      _popmenu_build( pop_menu, item1, item2, ... )
  2666.      
  2667. The pop_menu parameter can be a number from 0 to 3, to
  2668. specify the pop up menu being built.  The function then
  2669. takes a variable number of parameters which are the
  2670. menu item texts, terminated with a NULL.
  2671.  
  2672. For example:
  2673.  
  2674.      _popmenu_build( 0, "&Frog", "&Goat", "&Marmot",
  2675.         NULL );
  2676.      
  2677. Note that there is no menu title.  All three texts in
  2678. the example are menu items. Notice that ampersands are
  2679. used to indicate the position of hotkeys.  The pop up
  2680. menu items may also use the codes described under
  2681. _menu_build for adding check marks, horizontal bars,
  2682. etc. to the menus.
  2683.  
  2684. Functions are attached to the menu items using:
  2685.  
  2686.      _popmenu_functions( pop_menu, func1, func2, ... );
  2687.      
  2688. Where the functions are 'vfnptr' pointers to functions.
  2689. There should be an identical number of functions as
  2690. there were menu items in the corresponding call to
  2691. _popmenu_build.  A NOFN can be used as a place holder
  2692. if no function is to be attached to an item
  2693.  
  2694. Help text is added using:
  2695.  
  2696.      _popmenu_helptext( pop_menu, text1, text2, ... );
  2697.      
  2698. A text must be supplied for each menu item.  There
  2699. should be an identical  number of texts as there were
  2700. menu items in the call to _popmenu_build. The constant
  2701. NOTEXT can be used if there is no help text for an
  2702. item.
  2703.  
  2704. When pop up menus have been defined, using the
  2705. functions above, they can be called up with:
  2706.  
  2707.      _popmenu_go( pop_menu, row, col );
  2708.      
  2709. The menu is specified by its menu number, pop_menu.
  2710. The position on the screen is specified by the row and
  2711. column parameters.  The menu will appear on the screen
  2712. allowing the user to make a selection with either the
  2713. mouse or the keyboard.  When a selection is made the
  2714. menu will be removed  from the screen and the function
  2715. attached to the selected item will be run.
  2716.  
  2717. Often, the pop up menus will be called up by clicking
  2718. the mouse.  Often the right button is used.  In this
  2719. case the menu should pop up under the mouse cursor:
  2720.  
  2721.      _popmenu_atmouse( pop_menu );
  2722.      
  2723. This function assumes that the menu is being called up
  2724. after a mouse click over a window.  It reads the select
  2725. position from the global variables and positions the
  2726. menu at that position.  The function is designed to be
  2727. attached, either directly or indirectly, to a window's
  2728. 'select' mouse action hook.
  2729.  
  2730. The _popmenu_toggle function can be attached to a menu
  2731. item in order to toggle the state of that items check
  2732. mark.  The _popmenu_check function can also be used to
  2733. control the check mark.  _popmenu_enable is used to
  2734. grey out items on a pop up menu.  These functions
  2735. behave like their main menu counterparts, and are
  2736. described in the reference section of this manual.
  2737.  
  2738. Other Steph Facilities.
  2739.  
  2740.   The Initialise Function.
  2741.   
  2742. Steph provides a hook that allows function calls to be
  2743. added after your call to the steph_go() function, but
  2744. before control is passed to the user.  This hook can be
  2745. used when a piece of code should be run at the
  2746. beginning of program execution, but which needs to use
  2747. Steph's facilities. For example, you might like to show
  2748. a query asking 'Do you want instructions?'
  2749.  
  2750. The steph_go() function sets up the system with only
  2751. the main window, (zero) open.  You can use the
  2752. initialise function to open other windows, or to set up
  2753. the contents of windows.
  2754.  
  2755. To add an initialise function use:
  2756.  
  2757.      _set_initial_function( function );
  2758.      
  2759. Where function is a pointer to a standard hooked
  2760. function.
  2761.  
  2762.   The Loop Functions.
  2763.   
  2764. The loop function facility provides a mechanism whereby
  2765. functions can be set up such that they are called
  2766. repeatedly while Steph is waiting for keyboard or mouse
  2767. activity.  This allows a program to execute code that
  2768. is not attached to a specific window or menu item.
  2769.  
  2770. Steph calls loop functions many times a second
  2771. (depending on the speed of your computer).  There are
  2772. three places where loop functions can be attached:
  2773.  
  2774. 1) Waiting in the main input loop, where Steph waits
  2775. for input to the  windows.  This is the 'main' loop,
  2776. and it's loop function is the most  important, as Steph
  2777. spends most of her spare time waiting in this  loop.
  2778.  
  2779. 2) While waiting for keyboard or mouse activity in the
  2780. menus.
  2781.  
  2782. 3) While waiting for keyboard or mouse activity in
  2783. dialogue boxes.
  2784.  
  2785. A function is attached to the 'main loop' using the
  2786. function:
  2787.  
  2788.      _loop_setfunction( func );
  2789.      
  2790. where func is a pointer to a void function that will be
  2791. called repeatedly whilst waiting in this loop.  In most
  2792. situations this is the  only loop function that will be
  2793. required.
  2794.  
  2795. Steph leaves the main loop whilst processing menu or
  2796. dialogue box activity, which means that the main loop
  2797. function is not being called when menus are active  or
  2798. when a dialogue box is open on the screen. If it is
  2799. important that loop functions are executed in these
  2800. loops, you can attach them using the two following
  2801. functions:
  2802.  
  2803.      _loop_menufunction( func );
  2804.      _loop_dboxfunction( func );
  2805.      
  2806. You could attach the same function that is set for the
  2807. main loop function, or you could use a different
  2808. function in each case.
  2809.  
  2810. Notice that Steph's dialogue box sub-system is used
  2811. when a query box is active, or when a combo box is
  2812. active on the toolbar.  The dialogue loop function will
  2813. be called in each of these cases.
  2814.  
  2815. Because the loop functions are called repeatedly, you
  2816. should ensure that they execute and terminate quickly;
  2817. otherwise the user may notice that the program's
  2818. responses to keyboard and mouse events become sluggish.
  2819.  
  2820. A typical use might be to provide an Auto-Save function
  2821. in a word processor.  To do this you would set up a
  2822. loop function to measure the  elapsed time since the
  2823. last save.  In most cases, the specified time would not
  2824. have elapsed and the function would terminate
  2825. immediately.  When the specified time had elapsed the
  2826. auto-save code would be invoked, and the timer reset.
  2827.  
  2828.   Draggable dialogues.
  2829.   
  2830. Steph allows the user to drag dialogue boxes and query
  2831. boxes around the  screen by clicking and dragging the
  2832. mouse on their title bars.  The feature is, by default,
  2833. turned on for all dialogue boxes, and off for query
  2834. boxes.
  2835.  
  2836. The default behaviour can be overridden using the
  2837. following functions:
  2838.  
  2839.      _dbox_dragdefault( dragmode, snapmode );
  2840.      
  2841. _dbox_dragdefault can be called at any time, and causes
  2842. subsequent calls to _dbox_build to build dialogue boxes
  2843. which have dragging enabled or disabled according to
  2844. the value of the dragmode parameter.  Snapmode
  2845. determines whether dialogues will 'snap-back' to their
  2846. original positions after use, i.e. whether they will
  2847. recentre themselves on the screen next time they are
  2848. opened.
  2849.  
  2850. Once a dialogue has been built, the drag and snap
  2851. behaviour can be altered by calling the _dbox_setdrag
  2852. function:
  2853.  
  2854.      _dbox_setdrag( dbox, dragmode, snapmode );
  2855.      
  2856. The dialogue box is identified by the dbox parameter,
  2857. and the drag and snap mode set as above.
  2858.  
  2859. Query boxes are not stored by the system, so the only
  2860. function provided is:
  2861.  
  2862.      _query_dragdefault( dragmode );
  2863.      
  2864. The dragmode turns the drag feature on or off for all
  2865. subsequent query boxes.  Note that there is no
  2866. snapmode.  Since each query box is generated by Steph
  2867. when it is needed, they do not have a 'previous
  2868. position', so the snapmode parameter is not required.
  2869. All query boxes appear centred on the screen or a
  2870. window, as described elsewhere.
  2871.  
  2872.   Working with Lists.
  2873.  
  2874. Lists are used by Steph to store a number of types of
  2875. data, includuing list box and combo box contents, flash
  2876. box texts, etc.  A list can be thought of as a sequence
  2877. of strings, or 'items'.  One item is dilimited from the
  2878. next by a null '\0' character, and the list is terminated
  2879. with a pair of null characters.
  2880.  
  2881. The _s_buildlist function has been used in previous 
  2882. examples:
  2883.  
  2884.      list = _s_buildlist( char *liststring );
  2885.  
  2886. Where list is a char* pointer to the list, and liststring
  2887. contains the contents with which the list is initialised.
  2888.  
  2889. For example:
  2890.  
  2891.      char *my_list;
  2892.      my_list = _s_buildlist( "One\0Two\0Three\0" );
  2893.  
  2894. Notice that each item is followed by a null character,
  2895. including the last one.  When C adds a null to the end 
  2896. of the string it has the two null characters described 
  2897. above.
  2898.  
  2899. You can also create an empty list, which is useful prior
  2900. to using the insert and delete functions to create a list.
  2901. In this case the initialisation string is not required:
  2902.  
  2903.      list = _s_buildemptylist( void );
  2904.  
  2905. Once a list has been created, it can be interrogated using
  2906. the following functions:
  2907.  
  2908.      char *_s_list_item( char *list, unsigned number );
  2909.  
  2910. The function _s_list_item returns a pointer to the list
  2911. item specified by list, a pointer to the start of a
  2912. list, and number, the number of the item in the list,
  2913. where the first item is zero.
  2914.  
  2915.      unsigned _s_list_count( char *list );
  2916.  
  2917. Given a pointer to the start of a list, _s_list_count
  2918. will return the number of items in the list.
  2919.  
  2920. Supposing you have a pointer to an item in a list, such
  2921. as that returned by _s_list_item, you can advance that
  2922. pointer to the next item in the list using the function:
  2923.  
  2924.      char *_s_list_next( char *list );
  2925.  
  2926. The function will return NULL if there are no more items
  2927. in the list.
  2928.  
  2929. To add and remove items from a list, there are two functions:
  2930.  
  2931.      char *_s_list_insert( char *list, char *item, unsigned at );
  2932.  
  2933. The _s_list_insert function takes a pointer to a list, and item,
  2934. which is a null terminated (i.e. ordinary) string to be inserted.
  2935. The position for the new item in the list is given by the value
  2936. in at.  At can range from 0 to one greater than the number of items
  2937. in the list.  It therefore follows that items can be added at the 
  2938. beginning, the end, or at any position within the list.  The
  2939. function returns a pointer to the list, since it may have been
  2940. moved in memory.
  2941.  
  2942.      char *_s_list_delete( char *list, unsigned item );
  2943.  
  2944. The _s_list_delete function removes an item, specified by item
  2945. number, from the list.  The value of item may range from 0 to the
  2946. number of items in the list.  The function returns a pointer to
  2947. the updated list, which may have moved in memory.
  2948.  
  2949. Finally, there is a function to sort a list:
  2950.  
  2951.      char *_s_list_sort( char *list );
  2952.  
  2953. The function sorts a list into ascending alphabetic order,
  2954. using the ASCII codes of the characters.  A pointer is
  2955. returned since the modified list will have moved in memory.
  2956.  
  2957. Notice that the function _s_buildradiolist does not use a 
  2958. standard format list, and cannot be manipulated with these
  2959. functions.
  2960.  
  2961.   Memory allocation details.
  2962.   
  2963. Steph performs memory allocation using standard library
  2964. functions such as malloc and realloc.  All the memory
  2965. used by Steph, including window contents and text mode
  2966. screen area saves has therefore to come from the base
  2967. 640K of DOS memory.  Application code attached to Steph
  2968. can use any memory that is available, so you may choose
  2969. to use the base 640K, or to use extended or virtual
  2970. memory, depending on your needs.
  2971.  
  2972. The 640K of base memory is often in short supply, and
  2973. if it is in heavy demand, it may run out.  Fortunately,
  2974. Steph provides a mechanism for dealing with these
  2975. situations.  The same mechanism can be used by
  2976. application code to display consistent behaviour in out
  2977. of memory situations.
  2978.  
  2979.   The mem_handler function.
  2980.  
  2981. If a memory allocation fails, Steph calls a function
  2982. called the mem_handler.  The default mem_handler
  2983. displays a flash box saying that the system has run out
  2984. of memory, and prompting the user to save and quit the
  2985. application.  It makes no attempt to rectify the
  2986. problem, or free up extra memory.  Clearly, there will
  2987. be many situations in which a more intelligent response
  2988. is  required, and the mem_handler function must be
  2989. redefined.
  2990.  
  2991.   Redefining mem_handler.
  2992.  
  2993. The mem_handler function must be a function of type:
  2994.  
  2995.      void out_of_memory( void );
  2996.  
  2997. To attach a function to the mem_handler hook use:
  2998.  
  2999.      _steph_spec.mem_handler = out_of_memory;
  3000.  
  3001. The action taken by the replacement function is up to
  3002. you.  For example, you might use it to close down the
  3003. application tidily, or you may attempt to tidy up the
  3004. memory and free up enough space to re attempt the
  3005. allocation.
  3006.  
  3007. In the latter case, it may be useful to know how much
  3008. memory was requested.  This information can be found in
  3009. the variable:
  3010.  
  3011.      _steph_spec.mem_size;
  3012.  
  3013. Note that this variable will contain the total amount
  3014. of memory requested, even for a reallocation.  For
  3015. example:  If a block of memory if 200 bytes, and a
  3016. reallocation to 300 bytes fails, the value in mem_size
  3017. will be 300 bytes, rather than the extra 100 bytes.
  3018.  
  3019. Finally, the mem_handler function must return control
  3020. to Steph.  The function simply returns in the normal
  3021. way, however, using the _steph_spec.mem_flag variable
  3022. it is possible to instruct Steph to re attempt the
  3023. allocation.  This is demonstrated in the following
  3024. code:
  3025.      
  3026.      void out_of_memory( void )
  3027.      {
  3028.         /* This is the mem_handler function */
  3029.      
  3030.         printf( "Allocation of %d bytes failed.\n",
  3031.            _steph_spec.mem_size );
  3032.      
  3033.         /* Attempt to free some memory here */
  3034.         ...
  3035.      
  3036.         if( we have free'd enough memory )
  3037.            /* Instruct Steph to re attempt the allocation */
  3038.            _steph_spec.mem_flag = TRUE;
  3039.         else
  3040.            /* Do not re attempt the allocation */
  3041.            _steph_spec.mem_flag = FALSE;
  3042.      
  3043.         return;
  3044.      }
  3045.  
  3046. Notice that the mem_handler function does not attempt
  3047. to perform the allocation itself, but merely reports
  3048. back to Steph that it should be safe to do so.  Should
  3049. the second attempt fail Steph will call mem_handler
  3050. again.  Clearly, if the mem_handler keeps asking Steph
  3051. to retry, and Steph keeps failing to allocate the
  3052. memory, the system will be stuck in a loop.  You may
  3053. like to implement a counter to limit the system to,
  3054. say, five retries.
  3055.  
  3056.   Using the mem_handler mechanism from application
  3057.   code.
  3058.  
  3059. Your application code can use the mem_handler mechanism
  3060. whenever a malloc or realloc type call is made.  Code
  3061. similar to the following should be used to replace each
  3062. malloc call.  Notice that the allocation is placed in a
  3063. loop which is repeated as long as the mem_handler
  3064. returns a TRUE in the mem_flag variable.
  3065.  
  3066.      /* Attempt to allocate 123 bytes */
  3067.      
  3068.      char * ptr;
  3069.      
  3070.      do{
  3071.         _steph_spec.mem_flag = FALSE;
  3072.         _steph_spec.mem_size = 123;
  3073.      
  3074.         ptr = (char *)malloc( 123 * sizeof(char) );
  3075.      
  3076.         if( ptr == NULL )
  3077.            (_steph_spec.mem_handler)();
  3078.      
  3079.      }while( _steph_spec.mem_flag == TRUE );
  3080.      
  3081.      if( ptr == NULL )
  3082.      {
  3083.         /* The allocation failed */
  3084.      }
  3085.  
  3086. This is identical to the mechanism used by Steph herself
  3087. to allocate memory.
  3088.  
  3089. A neater way to allocate memory.
  3090.  
  3091. The description above shows you how to allocate memory
  3092. the hard way.  There is a way which leads to neater code,
  3093. which is explained below.  The reason for describing the
  3094. more complicated method first is to encourage you to
  3095. understand the way that the mem_handler system works.
  3096.  
  3097. Most of the time, when allocating memory, you are performing
  3098. a simple malloc, realloc or perhaps a strdup call.  In each
  3099. of these three situations you can let Steph handle the
  3100. do-loop details for you, by providing a function to mimic the
  3101. functions in the C runtime library.
  3102.  
  3103.      void *_s_malloc( unsigned size );
  3104.      void *_s_realloc( void *buffer, unsigned size );
  3105.      void *_s_strdup( char *string );
  3106.  
  3107. These three functions are designed to replace the similarly
  3108. named library functions.  
  3109.  
  3110. Example, a similar allocation to the previous example:
  3111.  
  3112.      /* Attempt to allocate 123 bytes */
  3113.      
  3114.      char * ptr;
  3115.  
  3116.      ptr = _s_malloc( 123 );     
  3117.      
  3118.      if( ptr == NULL )
  3119.      {
  3120.         /* The allocation failed */
  3121.      }
  3122.  
  3123. By comparing the examples you will see that the _s_malloc call
  3124. has replaced the entire do-loop.  The _s_realloc and _s_strdup
  3125. calls are used in exactly the same way.  When you need to
  3126. perform an allocation using a function other than malloc, realloc
  3127. or strdup you will need to program a do-loop.
  3128.  
  3129. Customising Steph.
  3130.  
  3131. Steph is designed so that she is fully customisable.
  3132. You can change the colours, line and box drawing
  3133. characters, and many aspects of the spacing and
  3134. positioning of elements on the screen.
  3135.  
  3136. Selected system variables are listed in the reference
  3137. section.
  3138.  
  3139. USING STEPH IN GRAPHICS MODE.
  3140.  
  3141. Steph operates primarily in text screen modes.  Each
  3142. character on the screen is identified by only two bytes
  3143. of data, a character and a colour. This means that even
  3144. 80 by 50 character modes use only 8000 bytes of data,
  3145. and that whole screens can be output very quickly.  By
  3146. comparison, a VGA graphics mode of 640 by 480 pixels,
  3147. in sixteen colours, uses 150K of  video memory.  The
  3148. amount of data that must be moved to and from the
  3149. screen is considerably greater, and makes hard work for
  3150. the computer.
  3151.  
  3152. Steph was designed to work in text modes and is
  3153. happiest when doing so.
  3154.  
  3155. Despite this, there may be occasions when you want to
  3156. use the Steph interface with a program that displays
  3157. pixel graphics.  For these occasions Steph can be made
  3158. to run in one of two graphics modes, EGA and VGA.  The
  3159. interface  retains the familiar character based
  3160. appearance, but allows graphics to appear in the
  3161. windows.  Although text based programs will work on the
  3162. most basic PC, graphics applications require an EGA
  3163. video system or greater (VGA, SVGA, XGA, etc).
  3164.  
  3165. Programming Steph to run in graphics modes requires a
  3166. little extra effort on your part.  There are a number
  3167. of changes which should be made to a text mode program
  3168. to make it run in a graphics mode:
  3169.  
  3170. 1) Set the computer into graphics mode.
  3171. 2) Call _steph_initialise with the M_GRAPHIC parameter.
  3172. 3) Set up screen save and restore functions.
  3173. 4) Call _steph_setupgraphic().
  3174. 5) Call _steph_go().
  3175. 6) Include code to restore the screen mode in your
  3176.    closedown code.
  3177.  
  3178. These steps are detailed below.  The discussion is relevant
  3179. whatever compiler you are using, although these examples
  3180. assume Microsoft.  A version of the save and restore functions
  3181. for Turbo C is provided in the file TC_GRAPH.C. 
  3182.  
  3183. Set the computer into graphics mode.
  3184.  
  3185. The mode chosen should have the equivalent of 80
  3186. columns of text, and should be a sixteen colour mode
  3187. with a four bit plane organisation.  Such modes include
  3188. modes 0x0E, 0x10, and 0x12, which are known as
  3189. _HRES16COLOR, _ERESCOLOR, and _VRES16COLOR in
  3190. Microsoft's GRAPH.H file.  Steph has only been tested
  3191. in these modes, although other modes with the same
  3192. structure may work.
  3193.  
  3194. Call _steph_initialise with the M_GRAPHIC parameter.
  3195.  
  3196. This instructs Steph to prepare for graphics mode.
  3197.  
  3198. Set up screen save and restore functions.
  3199.  
  3200. When Steph opens a menu or dialogue box on the screen
  3201. the background is saved into memory so that it can be
  3202. restored when the menu or dialogue is finished with.
  3203. In text modes this is not a problem, since the amounts
  3204. of data are small - 8000 bytes at the very most.  In a
  3205. graphics mode a large dialogue may need as much as 150K
  3206. of storage, and that could cause  problems if you have
  3207. a lot of data in memory, or need a number of large
  3208. dialogues to appear over each other.
  3209.  
  3210. For this reason, Steph allows you to provide your own
  3211. functions for saving and restoring areas of the screen.
  3212. You can save data into conventional memory if you are
  3213. confident that there is enough space, or you may prefer
  3214. to use extended or virtual memory.  Compression could
  3215. be applied to the data, or you could save it onto to
  3216. the hard disk.
  3217.  
  3218. When Steph calls your functions, the _pix_to_save
  3219. structure will contain relevant data.  Elements .x1,
  3220. .y1, .x2 and .y2 contain the absolute co-ordinates of
  3221. the top left and bottom right corners of the
  3222. rectangular area to be saved.  Your save function
  3223. should return a pointer of type (char *) in the
  3224. .data element.  The same pointer will be placed in
  3225. .data by Steph before your restore function is called.
  3226.  
  3227. These two example functions use calls to Microsoft's
  3228. GRAPHICS.LIB to copy blocks of the screen into
  3229. conventional memory.  You may like to adapt them to
  3230. your own needs:
  3231.  
  3232.  
  3233. void my_screen_save( void )
  3234. /* MICROSOFT ONLY,  Turbo C users see TC_GRAPH.C */
  3235. {
  3236.    long isize;
  3237.    char _huge *store;
  3238.  
  3239.    /* Find the size of the block to be saved from screen */
  3240.  
  3241.    isize = _imagesize( _pix_to_save.x1, _pix_to_save.y1,
  3242.       _pix_to_save.x2, _pix_to_save.y2 );
  3243.  
  3244.    /* Halve the block size because we need to allocate it
  3245.       in two byte blocks. */
  3246.  
  3247.    isize = (isize+1)/2; /* one added incase size was odd */
  3248.  
  3249.    /* Make space to store a pointer to the huge block that
  3250.       we are about to allocate for the data... */
  3251.  
  3252.    _pix_to_save.data = malloc( sizeof( char _huge * ) );
  3253.    if( _pix_to_save.data == NULL )
  3254.       return;
  3255.  
  3256.    /* This allocates the data space.
  3257.       (Element size must be power of two...) */
  3258.  
  3259.    store = (char _huge *)_halloc( isize , 2);
  3260.    if( store == (char _huge *)(NULL) )
  3261.       return;
  3262.  
  3263.    /* Store image (pixel) info using a call to
  3264.       GRAPHICS.LIB */
  3265.  
  3266.    _getimage( _pix_to_save.x1, _pix_to_save.y1,
  3267.       _pix_to_save.x2, _pix_to_save.y2, store );
  3268.  
  3269.    /* Store the pointer to the screen data in
  3270.       the .data member */
  3271.  
  3272.    /* _pix_to_save.data doesn't know that it is a
  3273.       pointer to a pointer to a huge character, so it
  3274.       must be cast. */
  3275.  
  3276.    *((char _huge **)_pix_to_save.data ) = store;
  3277. }
  3278.  
  3279.  
  3280. void my_screen_restore( void )
  3281. /* MICROSOFT ONLY,  Turbo C users see TC_GRAPH.C */
  3282. {
  3283.    /* _pix_to_save.data doesn't know that it is a
  3284.        pointer to a pointer to a huge character, so
  3285.        it must be cast */
  3286.  
  3287.    /* Restore the information onto the screen */
  3288.  
  3289.    _putimage( _pix_to_save.x1, _pix_to_save.y1,
  3290.       *((char _huge **)_pix_to_save.data), _GPSET );
  3291.  
  3292.    /* Free the huge buffer that the data was in. */
  3293.  
  3294.    _hfree( *((char _huge **)_pix_to_save.data) );
  3295.  
  3296.    /* Free the pointer store. */
  3297.  
  3298.    free( _pix_to_save.data );
  3299. }
  3300.  
  3301. Note that the _s_malloc function is NOT used for memory allocation
  3302. in these functions.  Steph automatically surrounds her call to
  3303. your save function with a mem_handler do-loop.  All your function 
  3304. must do to signal an allocation error is to return NULL is .data.
  3305.  
  3306. In these examples, data is stored in conventional memory,
  3307. and a pointer is stored to a buffer which  contains a pointer
  3308. to another buffer containing the data.  If you choose to store
  3309. the data elsewhere, such as on disk, or in extended memory,
  3310. you must be able to identify the block by that first pointer
  3311. value.  I would  suggest that you allocate a relatively small
  3312. amount of memory to store (more extensive) details of your
  3313. saved block, and return a pointer to that block to Steph. Note
  3314. that a NULL pointer is used to indicate an  allocation error.
  3315.  
  3316. Your restore function is responsible for deallocating
  3317. any memory used.
  3318.  
  3319. Call _steph_setupgraphic, giving details of the screen
  3320. size and pointers to the save and restore functions.
  3321.  
  3322. The _steph_setupgraphic function is called as follows:
  3323.  
  3324.      _steph_setupgraphic( hsize, vsize, saveptr,
  3325.         restoreptr )
  3326.      
  3327. Hsize and vsize are the horizontal and vertical size of
  3328. your screen mode in pixels.  Values for _VRES16COLOR
  3329. would be 640 and 480 respectively.
  3330.  
  3331. Saveptr and restoreptr are vfnptr type pointers to your
  3332. block save and restore functions, described above.
  3333.  
  3334. Call _steph_go
  3335.  
  3336. Steph will operate in graphics mode.  You will notice
  3337. that the screen updates are slower than in text modes.
  3338. If you are developing software for others to use,
  3339. please remember that their systems may not be as fast
  3340. as your development machine.  You can reduce the time
  3341. taken to redraw the screen by keeping dialogues and
  3342. menus small, and refreshing only those parts of windows
  3343. that need it.
  3344.  
  3345. In order to include graphics in a window, you should
  3346. set the draw mode to WD_USER by calling
  3347. _window_set_draw.  Set the draw function to be a
  3348. function which updates the window.  Your draw function
  3349. is then responsible (along with other parts of your
  3350. application code which may draw in the window) for all
  3351. clearing and drawing operations on that window.
  3352.  
  3353. The size of the window can be determined with a call to
  3354. the function _window_get_gsize, as can be coded as
  3355. follows:
  3356.  
  3357.      void my_draw_function( void )
  3358.      {
  3359.         /* create a _window_pix structure */
  3360.         struct _window_pix pix_info;
  3361.      
  3362.         /* fill the window pix structure.
  3363.            This code assumes window zero */
  3364.      
  3365.         pix_info = _window_get_gsize( 0 );
  3366.      
  3367.         /* pix_info now contains elements as follows:
  3368.      
  3369.            .xorigin
  3370.            .yorigin
  3371.            Absolute co-ordinates of top left corner of
  3372.            window area.
  3373.      
  3374.            .xsize
  3375.            .ysize
  3376.            Size of the window area in pixels.
  3377.         */
  3378.      
  3379.         /* do your drawing here... */
  3380.      }
  3381.      
  3382.  
  3383. Include code to restore the screen mode in your
  3384. closedown code.
  3385.  
  3386. A polite program always restores the video mode to the
  3387. one the system was in when the program was run!
  3388.  
  3389. REFERENCE.
  3390.  
  3391. User Functions.
  3392.  
  3393. This section lists the function prototypes for
  3394. functions that may be called by applications.
  3395.  
  3396. Functions not listed in this section are for internal
  3397. use by Steph, and are liable to change in later
  3398. versions.
  3399.  
  3400.   Setup And Go Functions.
  3401.  
  3402. char _steph_initialise( char gmode );
  3403.  
  3404. Initialise Steph.  This function should be called
  3405. before any of Steph's facilities are used.  All the
  3406. functions listed in this manual require Steph to have
  3407. been initialised using this function.
  3408.  
  3409. gmode   Normally M_TEXT.  M_GRAPHIC to use
  3410.         Steph in graphics modes.
  3411.  
  3412. Returns :
  3413. TRUE    Success.
  3414. FALSE   Failure  The current screen mode was unsuitable.
  3415.         (Screen mode must be 2, 3, or 7.  Screens may have 25,
  3416.         43 or 50 lines etc. )
  3417.  
  3418.  
  3419. void _steph_go( void );
  3420.  
  3421. Start the user interface, once menus, windows etc have
  3422. been  set up.  _steph_go() will return after displaying
  3423. an error message should you attempt to start the system
  3424. before the main window  (window zero) has been built,
  3425. or if no menu items have been defined.  An error is the
  3426. only circumstance under which the function will return,
  3427. in which case a message will have been displayed on the
  3428. screen.  Once the system has started the _steph_go()
  3429. function never returns,  and exit() must be called to
  3430. quit the application.  The system  variable
  3431. _steph_spec.steph_running is set to TRUE.
  3432.  
  3433.  
  3434. void _steph_closedown( void );
  3435.  
  3436. This function closes down Steph and tidies up the
  3437. system, ready  to exit the program.  The variable
  3438. _steph_spec.steph_running is  reset to FALSE.  The call
  3439. to _steph_closedown is usually followed  by an exit()
  3440. in order to return to the operating system.
  3441.  
  3442. NOTE: This function closes down services vital to
  3443. Steph.  The result of calling one of Steph's functions
  3444. is undefined after closedown, and doing so may cause an
  3445. immediate system crash or subsequent instability.
  3446.  
  3447.  
  3448. void _steph_version( char *version_string );
  3449.  
  3450. This function takes a pointer to a string and places in 
  3451. it a string representing the version number of the library
  3452. being used.  This string will never be greater than ten
  3453. characters including the \0 termination character, and
  3454. will be of the form "1.0b" where '1' is the major version
  3455. number, '0' is the minor version  number, and 'b' is the
  3456. revision number.
  3457.  
  3458. version_string    A pointer to a string (character array)
  3459.                 in which the version string will be 
  3460.                 stored.  A character array of ten elements
  3461.                 is suitable.
  3462.  
  3463.  
  3464.   Window Build Functions.
  3465.  
  3466. int _window_build( unsigned win, unsigned posn,
  3467.    unsigned startrows,  char *title, vfnptr filter,
  3468.    vfnptr keyaction, vfnptr mouseaction );
  3469.  
  3470. Build a window in memory.
  3471.  
  3472. win         The window number, zero for the MAIN window.
  3473. posn        The window position code.  Window zero should have
  3474.             WP_MAIN.  Other windows may be WP_TOP or WP_BOT.
  3475. startrows   The height of the window.
  3476. title       Pointer to a string that appears on the top
  3477.             border of the window as a title.
  3478. filter      Pointer to the keyboard filter function for the
  3479.             window.
  3480. keyaction   Pointer to the keyboard action function.
  3481. mouseaction Reserved for future use.
  3482.  
  3483. Returns :
  3484. TRUE    Success
  3485. FALSE   Failure.
  3486.  
  3487.  
  3488. void _window_mouse_functions( unsigned win, vfnptr close,
  3489.    vfnptr max, vfnptr min, vfnptr size, vfnptr vup, vfnptr vdown,
  3490.    vfnptr vdrag, vfnptr vpup, vfnptr vpdown,
  3491.    vfnptr hup, vfnptr hdown, vfnptr hdrag, vfnptr hpup,
  3492.    vfnptr hpdown, vfnptr unselect, vfnptr select,
  3493.    vfnptr activate );
  3494.  
  3495. This function attaches functions to the mouse event
  3496. hooks  for the window.
  3497.  
  3498. win                     The window number.
  3499. close, max,... activate Function pointers as described
  3500.                         in text.
  3501.  
  3502.  
  3503. void _window_set_draw( unsigned win, char drawmode,
  3504.    vfnptr drawfn );
  3505.  
  3506. Sets the drawing mode for the window, and also allows a
  3507. function to be attached to the redraw event.
  3508.  
  3509. win       The window number
  3510. drawmode  A constant for the draw mode required:
  3511.           WD_AUTO, WD_COLOUR, WD_CLEAR or WD_USER.  The draw
  3512.           modes are described elsewhere in this manual.
  3513. drawfn    A function called after each redraw event.
  3514.  
  3515.  
  3516.   Menu Build Functions.
  3517.  
  3518. int _menu_build( unsigned menu, char *menutext, ... );
  3519.  
  3520. Create a menu in memory.
  3521.  
  3522. menu       The menu number.
  3523. menutext   A pointer to the menu title.  Subsequent
  3524.            parameters are pointers to menu item texts, the
  3525.            list is terminated with a NULL pointer.
  3526.  
  3527. Returns :
  3528. TRUE    Success
  3529. FALSE   Failure.
  3530.  
  3531.  
  3532. void _menu_functions( unsigned menu, vfnptr afunc, ... );
  3533.  
  3534. Attach functions to the items in a previously built
  3535. menu.
  3536.  
  3537. menu    The menu number.
  3538. afunc   Pointer to the function attached to the first
  3539.         menu item for the menu.  There should be sufficient
  3540.         parameters for each item in the menu.  NOFN can be
  3541.         used to indicate that there is no attached function.
  3542.  
  3543.  
  3544. void _menu_helptext( unsigned menu, char *maintext,
  3545.    char *text, ... );
  3546.  
  3547. Sets the speed bar help text for the menu and menu
  3548. items.
  3549.  
  3550. menu      The menu number.
  3551. maintext  A pointer to the string to be displayed for
  3552.           the menu title (on the menu bar).
  3553. text      Pointer to string to be displayed for the first
  3554.           menu item.  There should be a further parameter for
  3555.           each menu item.  Use NOTEXT to indicate no text is
  3556.           displayed.
  3557.  
  3558.  
  3559.   Dialogue Box And Control Build Functions.
  3560.  
  3561. int _dbox_build( char dbox, char posn, char wide, char tall,
  3562.    char numctrl, char *title, char *helptext );
  3563.  
  3564. Build a dialogue box in memory.
  3565.  
  3566. dbox     The number of the dialogue box.
  3567. posn     Positioning code, DB_CENWIN, DB_CENSCR or
  3568.          DB_ABSPOS.
  3569. wide     Width of the window in characters.
  3570. tall     Height of the window in characters.
  3571. numctrl  Number of controls that dialogue will contain
  3572.          (maximum).
  3573. title    Pointer to string to be displayed on the top edge
  3574.          of the dialogue box's border.
  3575. helptext Pointer to string to be displayed on the speed
  3576.          bar when the dialogue is open.
  3577.  
  3578. Returns :
  3579. TRUE    Success.
  3580. FALSE   Failure.
  3581.  
  3582.  
  3583. void _dbox_setbars( unsigned dbox, char bar1, ... );
  3584.  
  3585. Sets horizontal dividing bars to be drawn across
  3586. dialogue boxes.
  3587.  
  3588. dbox     The number of the dialogue box.
  3589. bar1     The position of the bar, in characters from the
  3590.          top of the box.  Up to four bars can be listed, or the
  3591.          list can be terminated with _NO_BAR.
  3592.  
  3593.  
  3594. void _dbox_setdependants( unsigned dbox, int dep_one, ... );
  3595.  
  3596. Sets up the list of dependants for a dialogue box.
  3597. This affects  how data is restored when a dialogue is
  3598. ESCaped from.
  3599.  
  3600. dbox     The number of the dialogue box to set dependants
  3601.          for.
  3602. dep_one  The number of the first dependant dialogue box.
  3603.          The list may continue for up to sixteen dependants, or
  3604.          can be terminated with a _NO_DEPENDANT.
  3605.  
  3606.  
  3607. void _dbox_setabspos( unsigned dbox, char xpos, char ypos );
  3608.  
  3609. Set the screen position for a dialogue box build as
  3610. DB_ABSPOS.
  3611.  
  3612. dbox   The number of the dialogue box.
  3613. xpos   X position in characters.
  3614. ypos   Y position in characters.
  3615.  
  3616.  
  3617. void _dbox_c_label( unsigned dbox, unsigned cnum, char xpos,
  3618.    char ypos,  char *text );
  3619.  
  3620. Create a label on a dialogue box that has been built
  3621. previously.
  3622.  
  3623. dbox   The number of the dialogue box.
  3624. cnum   The number of the control.
  3625. xpos   X position of start of label on the dialogue.
  3626. ypos   Y position of start of label on the dialogue.
  3627. text   Pointer to string containing the label text.
  3628.  
  3629.  
  3630. void _dbox_c_frame( unsigned dbox, unsigned cnum, char xpos,
  3631.    char ypos,  char xsize, char ysize, char *title );
  3632.  
  3633. Create a frame on a dialogue box that has been built
  3634. previously.
  3635.  
  3636. dbox     The number of the dialogue box.
  3637. cnum     The number of the control.
  3638. xpos     X position of top left corner of frame on the
  3639.          dialogue.
  3640. ypos     Y position of top left corner of frame on the
  3641.          dialogue.
  3642. xsize    Width of frame in characters.
  3643. ysize    Height of frame in characters.
  3644. title    Pointer to a string to be displayed on the top
  3645.          edge of the frame, or NULL for none.
  3646.  
  3647.  
  3648. void _dbox_c_button( unsigned dbox, unsigned cnum, char xpos,
  3649.    char ypos,  char size, char *text, char exitflag,
  3650.    vfnptr function );
  3651.  
  3652. Create a button on a dialogue box that has been built
  3653. previously.
  3654.  
  3655. dbox     The number of the dialogue box.
  3656. cnum     The number of the control, which determines
  3657.          tabbing sequence.
  3658. xpos     X position of start of button on the dialogue.
  3659. ypos     Y position of start of button on the dialogue.
  3660. size     The width of the button, between 'chevrons'.
  3661. text     Pointer to string containing button text.
  3662. exitflag Determines how dialogue behaves when the
  3663.          button is pressed.  Can be EXIT to close dialogue
  3664.          retaining data, ESCAPE to close dialogue restoring old
  3665.          data, or NOEXIT to not exit.
  3666. function Pointer to a function to be called when the
  3667.          button is  pressed.
  3668.  
  3669.  
  3670. void _dbox_c_check( unsigned dbox, unsigned cnum, char xpos,
  3671.    char ypos,  char *text, int initval, vfnptr function );
  3672.  
  3673. Create a check box on a dialogue box that has been
  3674. built previously.
  3675.  
  3676. dbox     The number of the dialogue box.
  3677. cnum     The number of the control, which determines
  3678.          tabbing sequence.
  3679. xpos     X position of start of title text on the
  3680.          dialogue.
  3681. ypos     Y position of start of title text on the
  3682.          dialogue.
  3683. text     Pointer to string containing title text.
  3684. initval  TRUE for checked, or FALSE for not checked.
  3685. function Pointer to function called when check is
  3686.          changed.
  3687.  
  3688.  
  3689. void _dbox_c_radio( unsigned dbox, unsigned cnum, char *text,
  3690.    int initval, vfnptr function );
  3691.  
  3692. Create a radio button set on a dialogue box that has
  3693. been built  previously.
  3694.  
  3695. dbox     The number of the dialogue box.
  3696. cnum     The number of the control, which determines
  3697.          tabbing sequence.
  3698. text     Pointer to a buffer containing a radio_list.  See
  3699.          above.
  3700. initval  The number of the radio item first selected.
  3701. function Pointer to function called when selection
  3702.          changes.
  3703.  
  3704.  
  3705. void _dbox_c_text( unsigned dbox, unsigned cnum, char xpos,
  3706.    char ypos,  char xsize, char *title, char *text,
  3707.    vfnptr function, vfnptr filter );
  3708.  
  3709. Create a text control on a dialogue box that has been
  3710. built previously.
  3711.  
  3712. dbox     The number of the dialogue box.
  3713. cnum     The number of the control, which determines
  3714.          tabbing sequence.
  3715. xpos     X position of start of title text on dialogue.
  3716. ypos     Y position of start of title text on dialogue.
  3717. xsize    The number of characters contained in the text
  3718.          box.
  3719. title    Pointer to a string containing the control's
  3720.          title.
  3721. text     Pointer to a dynamic buffer containing the initial
  3722.          text.
  3723. function Pointer to a function called when a new text
  3724.          is entered.
  3725. filter   Pointer to the text box filter function.
  3726.  
  3727.  
  3728. void _dbox_c_list( unsigned dbox, unsigned cnum, char xpos,
  3729.    char ypos, char xsize, char ysize, char field,
  3730.    unsigned scrolls, char *title, char *list, char exitflag,
  3731.    vfnptr sfunction, vfnptr hfunction );
  3732.  
  3733. Create a list box on a dialogue box that has been built
  3734. previously.
  3735.  
  3736. dbox      The number of the dialogue box.
  3737. cnum      The number of the control, which determines
  3738.           tabbing sequence.
  3739. xpos      X position of start of title text on dialogue.
  3740. ypos      Y position of start of title text on dialogue.
  3741. xsize     Width of box in characters.
  3742. ysize     Height of box in characters.
  3743. field     Column width in horizontal boxes.
  3744.           scrolls DBL_HSCROLL for horizontal list, or DBL_VSCROLL
  3745.           for vertical.
  3746. title     Pointer to string containing title string.
  3747. list      Pointer to the initial list.
  3748. exitflag  EXIT to close dialogue when an item is
  3749.           selected from the  list, or NOEXIT otherwise.  ESCAPE
  3750.           is invalid.
  3751. sfunction Pointer to a function called when a selection
  3752.           is made.
  3753. hfunction Pointer to a function called when the
  3754. highlight moves to  a new item.
  3755.  
  3756.  
  3757. void _dbox_c_combo( unsigned dbox, unsigned cnum, char xpos,
  3758.    char ypos, char xsize, char ysize, int initial, char *title,
  3759.    char *list, char exitflag,  vfnptr sfunction,
  3760.    vfnptr hfunction );
  3761.  
  3762. Create a combo box on a dialogue box that has been
  3763. built previously.
  3764.  
  3765. dbox      The number of the dialogue box.
  3766. cnum      The number of the control, which determines
  3767.           tabbing sequence.
  3768. xpos      X position of start of title text on dialogue.
  3769. ypos      Y position of start of title text on dialogue.
  3770. xsize     Width of box in characters.
  3771. ysize     Height of open box in characters.
  3772. initial   Number of list item initially selected.
  3773. title     Pointer to a string containing the combo title
  3774.           text.
  3775. list      Pointer to the list.
  3776. exitflag  Exit flag, as for _dbox_c_list().
  3777. sfunction Pointer to function called when a selection
  3778.           is made.
  3779. hfunction Pointer to function called when the highlight
  3780.           is changed.
  3781.  
  3782.  
  3783. void _dbox_remove_control( unsigned dbox, unsigned cnum );
  3784.  
  3785. This function removes a control from a dialogue box.
  3786. Note that  Steph treats a gap in the list of controls
  3787. as the end of the list.
  3788.  
  3789. dbox      The number of the dialogue box.
  3790. cnum      The number of the control to remove.
  3791.  
  3792.  
  3793.   Miscellaneous Build Functions.
  3794.  
  3795. void _steph_initialfunction( vfnptr function );
  3796.  
  3797. Sets the initial function which will be called once
  3798. when Steph is  started, as described above.
  3799.  
  3800. function  A pointer to the function to be called.
  3801.  
  3802.  
  3803. void _loop_setfunction( vfnptr function );
  3804.  
  3805. Sets a pointer to a function which will be called
  3806. repeatedly whilst  the system is idle and waiting for
  3807. keyboard or mouse input from the  user in the main
  3808. input loop.
  3809.  
  3810. function  A pointer to the loop function.
  3811.  
  3812.  
  3813. void _loop_menufunction( vfnptr function );
  3814.  
  3815. Sets a pointer to a function which will be called
  3816. repeatedly whilst  the system is idle and waiting for
  3817. keyboard or mouse input from the  user in the menu
  3818. input loop.
  3819.  
  3820. function  A pointer to the loop function.
  3821.  
  3822.  
  3823. void _loop_dboxfunction( vfnptr function );
  3824.  
  3825. Sets a pointer to a function which will be called
  3826. repeatedly whilst  the system is idle and waiting for
  3827. keyboard or mouse input from the  user in one of the
  3828. dialogue input loop.
  3829.  
  3830. function  A pointer to the loop function.
  3831.  
  3832.  
  3833. void _window_setsyskey( vfnptr filter, vfnptr action );
  3834.  
  3835. Sets the filter and action functions to handle
  3836. keystrokes that are  valid in all windows, i.e. at the
  3837. 'system' level.
  3838.  
  3839. filter    Pointer to the filter function.
  3840. action    Filter to the system key action function.
  3841.  
  3842.  
  3843. char *_s_buildradiolist( char *liststring );
  3844.  
  3845. This function allocates a block of memory and uses it
  3846. to store  the specified radio button list.
  3847.  
  3848. liststring  A pointer to a string, usually a constant,
  3849.             containing the radio button list.  The list
  3850.             consists of a number of entries, each consisting
  3851.             of five bytes of data, followed immediately by
  3852.             the button label text as described above.  A zero 
  3853.             '\n' character is used to separate entries, and
  3854.             the final entry is followed by two zero characters
  3855.             to indicate the end of the list.
  3856.  
  3857. Returns :
  3858. char *  A pointer to the newly allocated buffer.
  3859. NULL    Failure.
  3860.  
  3861.  
  3862. Dialogue, Flash and Query Boxes.
  3863.  
  3864. void _dbox_go( unsigned dbox );
  3865.  
  3866. Opens a dialogue box on the screen, and directs user
  3867. input to the dialogue.
  3868.  
  3869. dbox    The number of the dialogue box to be opened.
  3870.  
  3871.  
  3872. void _dbox_draw_control( unsigned dbox, unsigned cnum );
  3873.  
  3874. Redraw the specified control on a dialogue box which is
  3875. open on the screen.  This function should be used when
  3876. the contents of a dialogue are changed by the application
  3877. while the dialogue is visible.
  3878.  
  3879. dbox   The number of the dialogue box.
  3880. cnum   The number of the control to be redrawn.
  3881.  
  3882.  
  3883. void _dbox_grey( unsigned dbox, unsigned cnum, unsigned radio,
  3884.    char grey );
  3885.  
  3886. Used to set the greyness (i.e. to activate or
  3887. deactivate) controls on a dialogue.
  3888.  
  3889. dbox   The number of the dialogue.
  3890. cnum   The number of the control to change.
  3891. radio  If the control is a set of radio buttons this
  3892.        parameter specifies the button number, otherwise it is
  3893.        ignored.
  3894. grey   TRUE to deactivate (grey) the control, FALSE to
  3895.        activate it.
  3896.  
  3897.  
  3898. void _dbox_set_global_keys( unsigned dbox, vfnptr filter,
  3899.    vfnptr action );
  3900.  
  3901. Sets up keyboard filter and action functions for a
  3902. dialogue box.
  3903.  
  3904. dbox   The number of the dialogue box.
  3905. filter A pointer to the keyboard filter function.
  3906. action A pointer to the function called to process keys
  3907.        that pass through the filter.
  3908.  
  3909.  
  3910. void _dbox_dragdefault( char drag, char snap );
  3911.  
  3912. Sets the default drag and snap-back for dialogue boxes
  3913. built subsequently.
  3914.  
  3915. drag   TRUE to make dialogues draggable, else FALSE.
  3916. snap   TRUE to make dialogues snap to their default
  3917.        position when next opened after having been dragged.
  3918.        FALSE for dialogues to reopen at the position to which
  3919.        they were last dragged.
  3920.  
  3921.  
  3922. void _dbox_setdrag( unsigned dbox, char drag, char snap );
  3923.  
  3924. Used to alter the drag and snap-back characteristics of
  3925. individual dialogues after they have been built.
  3926.  
  3927. dbox   The number of the dialogue box.
  3928. drag   TRUE to make the dialogue draggable, else FALSE.
  3929. snap   TRUE to make the dialogue snap to its default 
  3930.        position when next opened after having been dragged.
  3931.        FALSE for the dialogue to reopen at the position to
  3932.        which it was last dragged.
  3933.  
  3934.  
  3935. int _flash_box( char position, char *list );
  3936.  
  3937. Displays a flash box on the screen.  The flash box
  3938. contents are defined in the call to the function.  If a
  3939. flash box is already on  the screen, it will be removed
  3940. and replaced.
  3941.  
  3942. position  A constant, DB_CENSCR to centre the flash box
  3943.           on the screen, or DB_CENWIN to centre the flash box on
  3944.           the currently active window.
  3945. list      A list, such as one built with build_list(), where
  3946.           each item in the list is a line of text to be shown in
  3947.           the flash box.
  3948.  
  3949. Returns :
  3950. TRUE    Successful display.
  3951. FALSE   The flash box could not be displayed.
  3952.  
  3953.  
  3954. void flash_remove( void );
  3955.  
  3956. Removes any flash box from the screen if one is
  3957. present.
  3958.  
  3959.  
  3960. int _query_box( unsigned dbox, char position, char *textlist,
  3961.    char *buttonlist, char *helptext );
  3962.  
  3963. Displays a query box on the screen, and directs user
  3964. input to the query box.
  3965.  
  3966. dbox       The number of a dbox, in which the query box is
  3967.            built. The query box will replace any dialogue box
  3968.            that was previously in that position.
  3969. position   A constant, DB_CENSCR to centre the query box
  3970.            on the screen, or DB_CENWIN to centre the query box
  3971.            on the currently active window.
  3972. textlist   A list, such as one built by build_list(),
  3973.            where each item in the list is a line of text to be
  3974.            shown in the query box.
  3975. buttonlist A list, such as one built by build_list(),
  3976.            where each item in the list is a text to appear in
  3977.            a button on the query box.
  3978. helptext   A pointer to a string to be displayed on the
  3979.            speed bar while the query box is on screen.
  3980.  
  3981. Returns :
  3982. int     The number of the button pressed by the user.
  3983. QB_NONE No button was pressed.
  3984. QB_FAIL The query was not able to be displayed.
  3985.  
  3986.  
  3987. void _query_dragdefault( char drag );
  3988.  
  3989. Sets the drag mode for subsequent query boxes.  Since
  3990. query boxes are generated when a call to _query_box()
  3991. is made, there is no need for a snap-back setting.
  3992.  
  3993. drag    TRUE for query boxes to be draggable, else FALSE.
  3994.  
  3995.  
  3996.   Menu Functions.
  3997.  
  3998. void _menu_go( void );
  3999.  
  4000. Starts up the menu system by opening the leftmost menu.
  4001. This function is intended to be attached to a speed bar
  4002. button.
  4003.  
  4004.  
  4005. void _menu_toggle( void );
  4006.  
  4007. This function toggles the state of checkable menu
  4008. items.  It determines the menu and item number of the
  4009. checkable item automatically, and for this reason
  4010. should always be called from within a function attached
  4011. to a checkable menu item.  The function can be attached
  4012. to the menu item's function hook directly if there is
  4013. no other function to be called.
  4014.  
  4015.  
  4016. char _menu_check( unsigned menu, unsigned item, char check );
  4017.  
  4018. Sets the check mark on a checkable menu item.
  4019.  
  4020. menu   The menu number.
  4021. item   The item number or zero for the entire menu.
  4022. check  CHECKON to turn on the check mark or CHECKOFF to
  4023.        turn it off.
  4024.  
  4025. Returns:
  4026. char      The previous state of the check mark:  CHECKON or
  4027.           CHECKOFF.  NOCHECK will be returned if this is
  4028.           not a checkable item.  CHECKERROR indicates that
  4029.           the specified item did not exist.
  4030.  
  4031.  
  4032. char _menu_get_check( unsigned menu, unsigned item );
  4033.  
  4034. This function returns the state of the check mark for
  4035. the specified menu item.
  4036.  
  4037. menu     The menu number.
  4038. item     The item number or zero for the entire menu.
  4039.  
  4040. Returns:
  4041. char    The state of the check mark:  CHECKON or CHECKOFF.
  4042.         NOCHECK will be returned if this is not a checkable
  4043.         item.  CHECKERROR indicates that the specified item
  4044.         did not exist.
  4045.  
  4046.  
  4047. char _menu_enable( unsigned menu, unsigned item, char enable );
  4048.  
  4049. Used to control the greyness of a menu item.  Entire
  4050. menus can also be disabled by specifying item zero.
  4051.  
  4052. menu     The menu number.
  4053. item     The item number or zero for the entire menu.
  4054. enable   TRUE to enable the item, or FALSE to grey it
  4055.          out.
  4056.   
  4057.  
  4058. Window Functions.
  4059.  
  4060. int _window_open( unsigned win, char open );
  4061.  
  4062. Opens or closes a window that has been built
  4063. previously.
  4064.  
  4065. win     The number of the window to open or close.
  4066. open    A constant, OPEN or CLOSE.
  4067.  
  4068. Returns :
  4069. TRUE    Success
  4070. FALSE   Failure.
  4071.  
  4072.  
  4073. char _window_close( unsigned win );
  4074.  
  4075. Close the specified window.  It will be removed from
  4076. the screen at the next redraw, but will be retained in
  4077. memory.
  4078.  
  4079. win    The number of a currently open window to be
  4080.        closed.
  4081.  
  4082. Returns:
  4083. TRUE   Success.
  4084. FALSE  Failure.
  4085.  
  4086.  
  4087. int _window_make_active( unsigned win );
  4088.  
  4089. Change the currently active window.  The window must be
  4090. open  on the screen.
  4091.  
  4092. win    The number of the window to be made active.
  4093.  
  4094. Returns :
  4095. TRUE    Success.
  4096. FALSE   Failure.
  4097.  
  4098.  
  4099. void _window_maximise( unsigned win );
  4100.  
  4101. Maximise the specified window such that it occupies the
  4102. whole of the work area.
  4103.  
  4104. win    The number of the window to be maximised.
  4105.  
  4106.  
  4107. void _window_minimise( void );
  4108.  
  4109. Minimise the currently maximised window, returning the
  4110. windows to the arrangement that they were in before it
  4111. was maximised.
  4112.  
  4113.  
  4114. int _window_size( unsigned win, unsigned against,
  4115.    unsigned newrows );
  4116.  
  4117. Adjust the size of a window.
  4118.  
  4119. win      The number of the window to be resized.
  4120. against  The window to add/remove lines from to satisfy
  4121.          the request.
  4122. newrows  The number of rows to be given to the window.
  4123.  
  4124. Returns :
  4125. TRUE    Success.
  4126. FALSE   Failure.
  4127.  
  4128.  
  4129. void _window_controls( unsigned win, unsigned char controls );
  4130.  
  4131. Sets the controls used on a window.
  4132.  
  4133. win       The number of the window.
  4134. controls  A byte specifying the controls.  The byte can
  4135.           be constructed using the bitwise OR operator and the
  4136.           constants WC_CLOSE, WC_MAX, WC_MIN, WC_HSCROLL, and
  4137.           WC_VSCROLL.
  4138.  
  4139.  
  4140. void _window_title( unsigned win, char *newtitle );
  4141.  
  4142. Sets the title to be displayed on the top border of a
  4143. window.
  4144.  
  4145. win       The number of the window.
  4146. newtitle  A pointer to a string to be used as title.
  4147.  
  4148.  
  4149. void _window_draw( void );
  4150.  
  4151. Redraws all window borders, as part of the process of
  4152. refreshing the screen.  This should be called after
  4153. windows have been opened, closed  resized etc.
  4154.  
  4155.  
  4156. void _window_drawscrollblips( void );
  4157.  
  4158. Redraws the scroll bar blips on all windows.  The
  4159. _window[].vsblip and _window[].hsblip variables can be
  4160. set if necessary before the call.
  4161.  
  4162.  
  4163. void _window_set_vscroll_pc( unsigned win, int percent );
  4164.  
  4165. Sets the vertical scroll bar blip to a given
  4166. percentage.
  4167.  
  4168. win      The number of the window to change.
  4169. percent  Value between 0 and 100, to set blip position.
  4170.  
  4171.  
  4172. void _window_set_hscroll_pc( unsigned win, int percent );
  4173.  
  4174. As for _window_set_vscroll_pc(), but affecting the
  4175. horizontal scroll bar.
  4176.  
  4177.  
  4178. void _window_clear( unsigned win );
  4179.  
  4180. Clear the contents of a window to the paper colour.
  4181. The contents  of the window are retained, but not
  4182. displayed.
  4183.  
  4184. win    The number of the window to be cleared.
  4185.  
  4186.  
  4187. void _window_refresh( unsigned win );
  4188.  
  4189. Refresh a window, drawing the contents into the window.
  4190. This function operates only on a single, specified
  4191. window, in order to save time if you are able to
  4192. predict which windows are in need of a redraw.
  4193.  
  4194. win    The number of the window to be refreshed.
  4195.  
  4196.  
  4197. void _window_refresh_lines( unsigned win, unsigned start,
  4198.    unsigned end, char dofixed );
  4199.  
  4200. Refresh a window, drawing the contents into the window.
  4201. Only lines in the specified range will be refreshed,
  4202. possibly saving time over a full refresh.  If there are
  4203. 'fixed lines' in the window they can optionally be
  4204. refreshed.
  4205.  
  4206. win      The number of the window to be refreshed.
  4207. start    The start of a range of lines to be refreshed.
  4208. end      The end of the range of lines to be refreshed.
  4209. dofixed  TRUE to refresh fixed lines, or FALSE
  4210.          otherwise.
  4211.  
  4212.  
  4213. void _window_refresh_all( void );
  4214.  
  4215. Refresh all windows by calling _window_refresh() for
  4216. each window currently open on the screen.
  4217.  
  4218.  
  4219. void _window_setfixed( unsigned win, char fixed );
  4220.  
  4221. Sets the number of fixed lines for a window.
  4222.  
  4223. win      The window being addressed.
  4224. fixed    The number of lines to be fixed.  A value of zero
  4225.          turns fixed lines off.
  4226.  
  4227.  
  4228. unsigned _window_above( unsigned win );
  4229.  
  4230. Find the window which is above another window on the
  4231. screen.  The  window above the top window is the lowest
  4232. one.  The function ignores whether the windows are open
  4233. or closed.
  4234.  
  4235. win     The window of which you want to know the number of
  4236.         the window above.
  4237.  
  4238. Returns :
  4239. unsigned  The number of the window immediately above.
  4240.  
  4241.  
  4242. unsigned _window_below( unsigned win );
  4243.  
  4244. Find the window which is below another window on the
  4245. screen.  The  window below the bottom window is the top
  4246. one.  The function ignores whether the windows are open
  4247. or closed.
  4248.  
  4249. win      The window that you want to know the number of the
  4250.          window below.
  4251.  
  4252. Returns :
  4253. unsigned The number of the window immediately below.
  4254.  
  4255.  
  4256. unsigned _window_belowandopen( unsigned window );
  4257. unsigned _window_aboveandopen( unsigned window );
  4258.  
  4259. These two functions behave exactly as _window_above()
  4260. and  _window_below(), but will only return the number
  4261. of windows that are currently open on the screen.
  4262.  
  4263.  
  4264.   Window Buffer Functions.
  4265.  
  4266. int _wb_newline( unsigned win );
  4267.  
  4268. This function inserts a new line into a window's
  4269. contents buffer.  The line is inserted after the
  4270. current line, and the new line is made the new current
  4271. line.
  4272.  
  4273. win      The number of the window in whose buffer to add the
  4274.          line.
  4275.  
  4276. Returns :
  4277. TRUE    Success
  4278. FALSE   Failure.
  4279.  
  4280.  
  4281. int _wb_delline( unsigned win );
  4282.  
  4283. This function deletes the current line from the
  4284. contents buffer.
  4285.  
  4286. win     The number of the window in whose buffer to delete the
  4287.         line.
  4288.  
  4289. Returns :
  4290. TRUE    Success
  4291. FALSE   Failure.
  4292.  
  4293.  
  4294. int _wb_gotoline( unsigned win, unsigned linenum );
  4295.  
  4296. Set the current line to a particular line in a window's
  4297. contents buffer.
  4298.  
  4299. win      The number of the window in whose buffer to add the
  4300.          line.
  4301. linenum  The line which should be made the current line.
  4302.          The first line in the buffer is zero.
  4303.  
  4304. Returns :
  4305. TRUE    Success
  4306. FALSE   Failure.
  4307.  
  4308.  
  4309. int _wb_settext( unsigned win, char *thetext );
  4310.  
  4311. Set the text contents of the current line in the
  4312. window's contents buffer.
  4313.  
  4314. win      The number of the window in whose buffer to add the
  4315.          line.
  4316. thetext  A pointer to the text to be inserted into the
  4317.          buffer at this line.
  4318.  
  4319. Returns :
  4320. TRUE    Success.
  4321. FALSE   Failure.
  4322.  
  4323.  
  4324. int _wb_setend( unsigned win, int endcode );
  4325.  
  4326. Set the endcode for the current line in the window's
  4327. contents buffer.
  4328.  
  4329. win      The number of the window.
  4330. endcode  The endcode value to be stored for the current
  4331.          line.
  4332.  
  4333. Returns:
  4334. int    The endcode value stored.
  4335.  
  4336.  
  4337. int _wb_getend( unsigned win );
  4338.  
  4339. Reads the endcode value stored with the current line in
  4340. the window's contents buffer.
  4341.  
  4342. win    The number of the window.
  4343.  
  4344. Returns :
  4345. int     The endcode stored with the current line.
  4346.  
  4347.  
  4348. Window Colour Code Functions.
  4349.  
  4350. These functions are used to control the use of colour
  4351. in windows that are in drawing mode WD_COLOUR.  It
  4352. should be noted that a distinction is made between a
  4353. paper/ink combination and the default colours for a
  4354. window, even when they appear identical on the screen.
  4355.  
  4356.  
  4357. void _wbcc_setcolour( unsigned win, unsigned sline,
  4358.    unsigned schar, unsigned eline, unsigned echar,
  4359.    short ink, short paper );
  4360.  
  4361. This function is used to set the ink and paper colours
  4362. of a range of consecutive characters which may span a
  4363. number of lines.  If the constant _WD_CCODE is used for
  4364. both ink and paper colours the characters will be set
  4365. to the default colours for that window.
  4366.  
  4367. win      The window number.
  4368. sline    The line number (in the contents buffer) of the
  4369.          first character to be coloured.
  4370. schar    The character number within the line, of the
  4371.          first character to be coloured.
  4372. eline    The line number (in the contents buffer) of the
  4373.          last character to be coloured.
  4374. echar    The character number within the line, of the last
  4375.          character to be coloured.
  4376. ink      The ink colour to be applied, or _WD_CCODE.
  4377. paper    The paper colour to be applied, or _WD_CCODE.
  4378.  
  4379.  
  4380. void _wbcc_uncolour( unsigned win, unsigned line );
  4381.  
  4382. Removes all colour codes from a line in the window
  4383. contents buffer.
  4384.  
  4385. win    The window number.
  4386. line   The number of the line in the contents buffer.
  4387.  
  4388.  
  4389. void _wbcc_getcolour( unsigned win, unsigned line, 
  4390.    unsigned qchar, short *inks, short *papers );
  4391.  
  4392. This function returns the ink and paper colours of a
  4393. specified character in the window.
  4394.  
  4395. win     The window number.
  4396. line    The number of the line in the contents buffer.
  4397. qchar   The position of the character in the line, for
  4398.         which colours are required.
  4399. inks    A pointer to a short variable in which the ink
  4400.         colour will be returned.
  4401. papers  A pointer to a short variable in which the paper
  4402.         colour will be returned.
  4403.  
  4404.  
  4405.   Speed Bar Functions.
  4406.  
  4407. void _speed_text( char *text );
  4408.  
  4409. Display a text on the speed bar.
  4410.  
  4411. text    A pointer to the text string to be displayed.
  4412.  
  4413.  
  4414. void _speed_setbar( char *text );
  4415.  
  4416. Set the default speed bar text.
  4417.  
  4418. text    A pointer to the text to be used as the default
  4419.         speed bar text.
  4420.  
  4421.  
  4422. void _speed_show( void );
  4423.  
  4424. Redraw the default speed bar text.
  4425.  
  4426.  
  4427. void _speed_wipebar( void );
  4428.  
  4429. Blank the entire speed bar.
  4430.  
  4431.  
  4432. void _speed_drawfn( vfnptr func );
  4433.  
  4434. Set a function that is called whenever the default
  4435. speed bar is  redrawn.
  4436.  
  4437. func     A pointer to the function to be called when the
  4438.          default speed bar is redraw.
  4439.  
  4440.  
  4441. void _speed_clickfn( vfnptr func );
  4442.  
  4443. Set a function that is called when the mouse is clicked
  4444. over the speed bar.
  4445.  
  4446. func     A pointer to the function to be called when the
  4447.          speed bar is clicked.
  4448.  
  4449.  
  4450. int _speed_button_set( unsigned button, char *text,
  4451.    char chevron, vfnptr func );
  4452.  
  4453. Create a button to be displayed on the speed bar.
  4454.  
  4455. button    The button number.
  4456. text      The button text string.
  4457. chevron   TRUE to display chevrons around the button
  4458.           text, otherwise FALSE.
  4459. func      The function that is called when the button is
  4460.           clicked.
  4461.  
  4462.  
  4463. void _speed_button_colour( unsigned button, short ink,
  4464.    short paper );
  4465.  
  4466. Sets the colours of a speed bar button.
  4467.  
  4468. button    The button number.
  4469. ink       The ink colour to be used.
  4470. paper     The paper colour to be used.
  4471.  
  4472.  
  4473. void _speed_button_remove( unsigned button );
  4474.  
  4475. Removes a button from the speed bar button list.  Note
  4476. that a space left in the list of buttons will be
  4477. treated as the end of the list.
  4478.  
  4479. button    The number of the button to be removed.
  4480.  
  4481.  
  4482.   Tool Bar Functions.
  4483.  
  4484. int  _toolbar_reserve( char number );
  4485.  
  4486. Called before Steph is started to reserve space for the
  4487. tool bar.
  4488.  
  4489. number    The number of tool bar lines to reserve.
  4490.  
  4491.  
  4492. void _toolbar_wipe( void );
  4493.  
  4494. Blanks the tool bar.
  4495.  
  4496.  
  4497. int _toolbar_set( char bar, char *text );
  4498.  
  4499. Sets the text which will be displayed on a particular
  4500. line of the  tool bar.
  4501.  
  4502. bar      The tool bar to place the text on.
  4503. text     The string to be displayed.
  4504.  
  4505.  
  4506. void _toolbar_draw( void );
  4507.  
  4508. Redraw the toolbar, text, and controls.
  4509.  
  4510.  
  4511. void _toolbar_drawfn( vfnptr func );
  4512.  
  4513. Sets a function which is called when the tool bar is
  4514. redrawn.
  4515.  
  4516. func     A pointer to the function.
  4517.  
  4518.  
  4519. void _toolbar_clickfn( vfnptr func );
  4520.  
  4521. Sets a function which is called when a mouse click is
  4522. made over  the toolbar, but which is not picked up by
  4523. one of the controls.
  4524.  
  4525. func     A pointer to the function.
  4526.  
  4527.  
  4528. int _toolbar_set_button( char control, char bar, char pos,
  4529.    char *text,  vfnptr func );
  4530.  
  4531. Creates a button control on the tool bar.
  4532.  
  4533. control   The control number.
  4534. bar       The toolbar line to be used.
  4535. pos       The start column of the control.
  4536. text      A string containing the button text.
  4537. func      A function called when the button is clicked.
  4538.  
  4539.  
  4540. int _toolbar_set_toggle( char control, char bar, char pos,
  4541.     char *text, char initial, vfnptr onfunc, vfnptr offfunc );
  4542.  
  4543. Creates a toggle button control on the tool bar.
  4544.  
  4545. control   The control number.
  4546. bar       The toolbar line to be used.
  4547. pos       The start column of the control.
  4548. text      A string containing the toggle button text.
  4549.           initial The initial state of the toggle, ON or OFF.
  4550. onfunc    A function called when the toggle is turned ON.
  4551. offfunc   A function called when the toggle is turned
  4552.           OFF.
  4553.  
  4554.  
  4555. int _toolbar_set_combo( char control, char bar, char pos,
  4556.    char xsize, char ysize, char *text,
  4557.    char *list, char initial, vfnptr sfunc );
  4558.  
  4559. Creates a combo box control on the tool bar.
  4560.  
  4561. control   The control number.
  4562. bar       The toolbar line to be used.
  4563. pos       The start column of the control.
  4564. xsize     The width of the data selection box and pop-up
  4565.           list.
  4566. ysize     The depth of the pop-up list.
  4567. text      A string containing the combo title text.
  4568.           list A pointer to the data list, such as created by
  4569.           build_list().
  4570. initial   The data item selected from the list
  4571.           initially.
  4572. sfunc     A function called when a selection is made from
  4573.           the list.
  4574.  
  4575.  
  4576. void _toolbar_draw_control( char control );
  4577.  
  4578. Redraw the control onto the tool bar.
  4579.  
  4580. control   The control to be redrawn.
  4581.  
  4582.  
  4583. void _toolbar_grey( char control, char grey );
  4584.  
  4585. Set the greyness of a control.
  4586.  
  4587. control   The control to be altered.
  4588. grey      The new greyness - GREY or NOTGREY.
  4589.  
  4590.  
  4591. void _toolbar_remove_control( char control );
  4592.  
  4593. Remove a control from the tool bar list.
  4594.  
  4595. control   The control to be removed.
  4596.  
  4597.  
  4598.   List functions.
  4599.  
  4600. char *_s_buildlist( char *liststring );
  4601.  
  4602. This function is used to build a list suitable for list
  4603. or combo box contents.
  4604.  
  4605. liststring  A pointer to a string, usually a constant,
  4606.             containing the list.  The list contains a
  4607.             number of entries, each of which is a text
  4608.             terminated with a zero '\n' character.  The
  4609.             final entry is followed with two zero characters,
  4610.             to indicate the end of the list.
  4611.  
  4612. Returns :
  4613. char *  A pointer to the newly allocated buffer.
  4614. NULL    Failure.
  4615.  
  4616.  
  4617. char *_s_buildemptylist( void );
  4618.  
  4619. This function is used to build an empty list suitable for list
  4620. or combo box contents.
  4621.  
  4622. Returns :
  4623. char *  A pointer to the newly allocated buffer.
  4624. NULL    Failure.
  4625.  
  4626.  
  4627. char *_s_list_item( char *list, unsigned item );
  4628.  
  4629. Finds the specified item within a list.
  4630.  
  4631. list      A pointer to the start of the list.
  4632. item      The number of the item to be found.
  4633.  
  4634. Returns:
  4635. char * A pointer to the item within the string.
  4636. NULL   Failure.
  4637.  
  4638.  
  4639. unsigned _s_list_count( char *list );
  4640.  
  4641. Used to determine the number of entries in a list.
  4642.  
  4643. list      A pointer to the start of the list.
  4644.  
  4645. Returns:
  4646. unsigned  The number of items in the list.
  4647.  
  4648.  
  4649. char *_s_list_next( char *listptr );
  4650.  
  4651. Advances a pointer such that it points to the beginning
  4652. of the next item in the list.
  4653.  
  4654. listprt   A pointer to an item in the list.
  4655.  
  4656. Returns:
  4657. char * A pointer to the beginning of the next item.
  4658. NULL   Failure.
  4659.  
  4660.  
  4661. char *_s_list_insert( char *list, char *item, unsigned at );
  4662.  
  4663. Used to insert an item into a list at the specified position.
  4664.  
  4665. list      A pointer to the start of the list.
  4666. item      A pointer to a string to be inserted into the list.
  4667. at        The position within the list, between zero and the 
  4668.           number of items in the list.
  4669.  
  4670. Returns:
  4671. char * A pointer to the modified list.
  4672. NULL   Failure.
  4673.  
  4674.  
  4675. char *_s_list_delete( char *list, unsigned item );
  4676.  
  4677. This function removes an item from a list.
  4678.  
  4679. list      A pointer to the start of the list.
  4680. item      The number of the item to remove, between 0
  4681.           and one less than the number of items in the list.
  4682.  
  4683. Returns:
  4684. char * A pointer to the modified list.
  4685. NULL   Failure.
  4686.  
  4687.  
  4688. char *_s_list_sort( char *list );
  4689.  
  4690. Sorts a list into alphabetical order using the ASCII codes
  4691. of characters to determine order.
  4692.  
  4693. list      A pointer to the start of the list.
  4694.  
  4695. Returns:
  4696. char * A pointer to the sorted list.
  4697. NULL   Failure.
  4698.  
  4699.  
  4700.   Mouse And Miscellaneous Functions.
  4701.  
  4702. void _mouse_on( void );
  4703.  
  4704. This function initialises the mouse driver and turns
  4705. the pointer on.  The _mouse_vis function should be used
  4706. to control mouse visibility wherever possible.
  4707.  
  4708.  
  4709. void _mouse_off( void );
  4710.  
  4711. This function deactivates the mouse and hides the
  4712. pointer.  The _mouse_vis function should be used to
  4713. control mouse visibility wherever possible.
  4714.  
  4715.  
  4716. void _mouse_vis( int vis );
  4717.  
  4718. This function is used to turn the mouse pointer on and
  4719. off.
  4720.  
  4721. vis       A constant ON or OFF, for visible or invisible.
  4722.  
  4723.  
  4724. byte _mouse_nowbutton( void );
  4725.  
  4726. A function to return the current state of the mouse
  4727. buttons.
  4728.  
  4729. Returns :
  4730. byte    A byte to indicate the button status.  Bit zero is
  4731.         set when the left button is pressed, bit one is set
  4732.         when the right button is pressed, and bit two is set
  4733.         when the centre button is pressed, if it is present and
  4734.         supported by the mouse driver.
  4735.  
  4736.  
  4737. Macros of the form MBx_ISDOWN( status ) and MBx_ISUP(
  4738. status ) can be used to return a TRUE or FALSE
  4739. interpretation of the status byte  where 'x' is either
  4740. L, R, or C to specify the button.  Status is the status
  4741. byte as returned by _mouse_nowbutton().
  4742.  
  4743.  
  4744. int _s_insmode( int onoff );
  4745.  
  4746. Changes the keyboard insert, or overtype mode.
  4747.  
  4748. onoff     A constant ON or OFF for insert or overtype.
  4749.  
  4750. Returns :
  4751. int       The insert mode set by the function.
  4752.  
  4753.  
  4754. void _s_time_delay( float seconds );
  4755.  
  4756. Pause program execution for a specified period of time.
  4757.  
  4758. seconds   The number of seconds to pause.
  4759.  
  4760.  
  4761.   Cursor functions.
  4762.  
  4763. Steph provides all the functions necessary to control
  4764. the shape, position and visibility of the cursor.
  4765. These functions should be used instead of similar
  4766. functions provided by the compiler, which may not be
  4767. compatible with Steph.
  4768.  
  4769.  
  4770. void _s_settextposition( char row, char column );
  4771.  
  4772. Position the cursor.
  4773.  
  4774. row      The row to position the cursor at.  Row 1 is the
  4775.          top.
  4776. column   The column to position the cursor at.  The
  4777.          extreme left of the screen is column one.
  4778.  
  4779.  
  4780. short _s_gettextcursor( void );
  4781.  
  4782. Get the shape of the current cursor.
  4783.  
  4784. Returns :
  4785. short   A value indicating the cursor shape, as returned
  4786.         by BIOS interrupt 10h, function 03h.
  4787.  
  4788.  
  4789. void _s_settextcursor( short cursor );
  4790.  
  4791. Set the shape of the cursor.
  4792.  
  4793. cursor   The high byte contains the start scan line for
  4794.          the cursor in the range 0 to 15.  The low byte
  4795.          contains the finish  scan line in the range 0 to 15.
  4796.  
  4797.  
  4798. void _s_displaycursor( int onoff );
  4799.  
  4800. Turns the cursor on or off.
  4801.  
  4802. onoff    Either ON or OFF.
  4803.  
  4804.  
  4805.   Keyboard functions.
  4806.  
  4807. These functions are available for reading data from the
  4808. keyboard.  Note that Steph provides most of the
  4809. necessary keyboard handling, so these functions will
  4810. only be required in exceptional circumstances.
  4811.  
  4812.  
  4813. byte _s_shift_key_read( void );
  4814.  
  4815. Reads the state of the shift keys from the BIOS.
  4816.  
  4817. Returns :
  4818. byte    A byte containing the shift key states, as
  4819.         returned by BIOS interrupt 16h, function 02h.
  4820.  
  4821.  
  4822. void _s_key_read( char *k1, char *k2 );
  4823.  
  4824. Reads a keystroke from the BIOS.
  4825.  
  4826. k1     Pointer to char variable in which ASCII key code
  4827.        will be returned
  4828. k2     Pointer to char variable in which the key scan code
  4829.        will be returned.
  4830.  
  4831. For ASCII keys, k1 will contain the ASCII code of the
  4832. key, and k2 will be zero.  For non-ASCII keys, such as
  4833. cursors, k1 will contain zero  and k2 will contain the
  4834. scan code of the key.
  4835.  
  4836.  
  4837. char _s_wait_for_key( void );
  4838.  
  4839. Pause until a key is pressed.  The function will return
  4840. immediately if there is a keystroke waiting in the
  4841. buffer.
  4842.  
  4843. Returns :
  4844. char    The ASCII code of the key that was pressed, or
  4845.         zero for a non-ASCII key.
  4846.  
  4847.  
  4848. char _s_key_for_me( void );
  4849.  
  4850. Used to determine whether there is a key waiting in the
  4851. keyboard buffer.  The key is not removed from the
  4852. buffer.
  4853.  
  4854. Returns :
  4855. TRUE    If a key is waiting.
  4856. FALSE   There is no key waiting.
  4857.  
  4858.  
  4859. void _s_flush_keyboard( void );
  4860.  
  4861. Empties the keyboard buffer.  This function can be
  4862. called before a  call to _s_wait_for_key() to ensure
  4863. that _s_wait_for_key() doesn't return immediately.
  4864.  
  4865.  
  4866.   Functions for Graphics Modes.
  4867.  
  4868. void _steph_setupgraphic( unsigned xpix, unsigned ypix,
  4869.    vfnptr save, vfnptr restore );
  4870.  
  4871. Describes the screen size of the graphics mode to
  4872. Steph, and sets up the user defined screen save and
  4873. restore function pointers.
  4874.  
  4875. xpix     Number of pixels across the screen.
  4876. ypix     Number of pixels down the screen.
  4877. save     Pointer to the user screen save function.
  4878. restore  Pointer to the user screen restore function
  4879.  
  4880.  
  4881. struct _window_pix _window_get_gsize( unsigned win );
  4882.  
  4883. Returns the size of the usable area of the specified
  4884. window in pixels, and the position of the top left
  4885. corner in pixels from the top left corner of the
  4886. screen.
  4887.  
  4888. win      The window number
  4889.  
  4890. Returns:
  4891. struct _window_pix   A structure containing the size and
  4892.                      position of the window's usable area
  4893.                      in pixels.  The structure is described
  4894.                      in the description of Steph's data
  4895.                      structures, below.
  4896.  
  4897.  
  4898.   Popup Menu Functions.
  4899.  
  4900. Popup menus are very similar to Steph's menu bar menus.
  4901. The functions described below are similar to the
  4902. equivalent functions for the bar menus, with the
  4903. exception that popup menus do not have a menu name.
  4904.  
  4905.  
  4906. int _popmenu_build( unsigned menu, char *menutext, ... );
  4907.  
  4908. This function is used to build popup menus.  There is
  4909. space for four popup menus to be built, numbered from
  4910. zero to three.
  4911.  
  4912. menu      The popup menu number.
  4913. menutext  A pointer to the text of the first menu item.
  4914.           Subsequent parameters are pointers to further
  4915.           menu item texts, the list is terminated with
  4916.           a NULL pointer.
  4917.  
  4918. Returns :
  4919. TRUE    Success
  4920. FALSE   Failure.
  4921.  
  4922.  
  4923. void _popmenu_functions( unsigned menu, vfnptr afunc, ... );
  4924.  
  4925. Attach functions to the items in a previously built
  4926. popup menu.
  4927.  
  4928. menu    The popup menu number.
  4929. afunc   Pointer to the function attached to the first
  4930.         menu item for the menu.  There should be the correct
  4931.         number of parameters for each item in the menu.  NOFN
  4932.         can be used to indicate that there is no attached
  4933.         function.
  4934.  
  4935.  
  4936. void _popmenu_helptext( unsigned menu, char *text, ... );
  4937.  
  4938. Sets the speed bar help text for the popup menu items.
  4939.  
  4940. menu    The popup menu number.
  4941. text    Pointer to string to be displayed for the first
  4942.         menu item.  There should be a further parameter for
  4943.         each menu item.  Use NOTEXT to indicate no text is
  4944.         displayed.
  4945.  
  4946.  
  4947. void _popmenu_go( unsigned menu, char row, char col );
  4948.  
  4949. Opens the specified menu for keyboard or mouse input.
  4950. The position of the menu on the screen can be chosen.
  4951.  
  4952. menu    The popup menu number.
  4953. row     The position of the menu in character rows.
  4954. col     The position of the menu in character columns.
  4955.  
  4956.  
  4957. void _popmenu_atmouse( unsigned menu );
  4958.  
  4959. This function opens the specified menu at the most
  4960. recent mouse select position.  That is, the position at
  4961. which the mouse was last clicked over the active
  4962. window.  The menu can be made to appear with either top
  4963. left or top right corner under the mouse pointer
  4964. according to the value in the global variable
  4965. _menu_spec.pop_left.  The function is intended to be
  4966. called from within the function attached to a window's
  4967. mouse select hook.
  4968.  
  4969.  
  4970. char _popmenu_enable( unsigned menu, unsigned item,
  4971.    char enable );
  4972. void _popmenu_toggle( void );
  4973. char _popmenu_check( unsigned menu, unsigned item, char
  4974.    check );
  4975. char _popmenu_get_check( unsigned menu, unsigned item );
  4976.  
  4977. These four functions are identical in operation to the
  4978. similarly named _menu functions.  The exception is that
  4979. since popup menus have no item 0 this value cannot be
  4980. used in a call to _popmenu_enable.
  4981.  
  4982.  
  4983. Selected System Variables.
  4984.  
  4985. This reference section lists selected members from the
  4986. various Steph data structures, that may be of interest.
  4987.  
  4988. Variables not listed here should not be accessed, as
  4989. they are liable to change in later versions of Steph.
  4990. The ordering of variables in these lists may differ
  4991. from the order of variables in memory.
  4992.  
  4993. Some variables are marked read-only.  These are
  4994. variables that are maintained by Steph, but may be of
  4995. interest to the application programmer.  The read-only
  4996. status is not enforced, that is, you could write values
  4997. into these variables, but to do so would make Steph
  4998. unstable, and could cause a system crash.
  4999.  
  5000. The other variables are marked as initialise-only.
  5001. These variables define the appearance of Steph, and
  5002. should be set up after the call to steph_initialise(),
  5003. which sets up default values, and before the call to
  5004. steph_go().  Attempting to change these variables while
  5005. Steph is active will at best cause inconsistency in the
  5006. appearance of the system, and at worst, cause a system
  5007. crash.
  5008.  
  5009. Default values for INIT variables are in brackets ().
  5010. Where colour default values differ according to
  5011. graphics adapter, they are shown as (colour, mono).
  5012.  
  5013.  
  5014.   General system variables.
  5015.  
  5016. The _steph_spec structure stores information about the
  5017. general Steph system:
  5018.  
  5019. _steph_spec.
  5020.  
  5021. char      steph_running  R/O  Set to TRUE after steph_go() and
  5022.                               reset to false after 
  5023.                               _steph_closedown().
  5024. int       mode           R/O  Graphics adapter type, _COLOUR or
  5025.                               _MDAHERC
  5026. char      gmode          R/O  Screen mode, _TEXT or M_GRAPHIC.
  5027. unsigned  row, col       R/O  Size of the screen in characters
  5028. short     cursor         INIT Cursor shape for insert
  5029.                               mode (0x0707)
  5030. short     otcursor       INIT Cursor shape for overtype
  5031.                               mode (0x0007)
  5032. vfnptr    mem_handler    INIT Pointer to function called when
  5033.                               memory allocation fails.
  5034. char      mem_flag            Usually FALSE.  The mem_handler function
  5035.                               should set it to TRUE to indicate
  5036.                               that the application should re attempt
  5037.                               the allocation.
  5038. uns. long mem_size            Set to the number of bytes
  5039.                               requested by a failed allocation, so that
  5040.                               the mem_handler can attempt to free a
  5041.                               suitable block.  May contain zero if the
  5042.                               block size could not be determined.
  5043. char *    nomemlist      INIT Pointer to a list of texts which
  5044.                               are displayed by the default mem_handler
  5045.                               function.  May also be used by alternative
  5046.                               mem_handler functions.
  5047.  
  5048.  
  5049.   Window variables.
  5050.  
  5051. The _window_spec structure stores information about
  5052. general window appearance and behaviour:
  5053.  
  5054. _window_spec.
  5055.  
  5056. unsigned  active         R/O  Which window is active now?
  5057. int       maximise       R/O  Number of window that is maximised
  5058.                               now, or -1 for none.
  5059. int       lastbuilt      R/O  The last window built.
  5060. unsigned  wincount       R/O  Number of windows built.
  5061. unsigned  ttop           R/O  The toppest top window.
  5062. unsigned  btop           R/O  The lowest top window.
  5063. unsigned  tbottom        R/O  The toppest bottom window.
  5064. unsigned  bbottom        R/O  The lowest bottom window.
  5065. char      control_gap    INIT The number of characters between
  5066.                               the left border and the close control,
  5067.                               and between the min/max controls and the
  5068.                               right border. (1)
  5069. char      title_gap      INIT Number of blank chars around window
  5070.                               titles. (1)
  5071. char      sbinhib        INIT Turn off scroll bars when a window is
  5072.                               less than this number of rows. (4)
  5073. short     border_paper   INIT Border background colour. (1,0)
  5074. short     border_ink     INIT Border foreground colour. (7)
  5075. short     title_hilite   INIT Active window title text colour. (0)
  5076. short     title_ink      INIT Inactive window title text and
  5077.                               active window title background colour. (7)
  5078. short     title_paper    INIT Inactive title background colour. (1,0)
  5079. short     scroll_paper   INIT Scroll bar background colour. (7)
  5080. short     scroll_ink     INIT Scroll bar foreground colour. (0)
  5081. short     drag_ink       INIT Title bar foreground during resize. (8)
  5082. short     drag_paper     INIT Title bar background during resize. (0)
  5083. char      border[23]     INIT Window border characters (see notes.)
  5084. char      key1           R/O  ASCII code store used for window/global
  5085.                               filter functions.
  5086. char      key2           R/O  Scan code store used for window/global
  5087.                               filter functions.
  5088. byte      mousecode      INIT Mouse button events recognised by a
  5089.                               window. (M_ANYPRESS)
  5090. byte      mousecontrol   INIT      Subset of mousecode.  Mouse button events
  5091.                                    that activate window controls. (M_LEFTP)
  5092. unsigned  last_action_window  R/O  Number of window on which last mouse
  5093.                                    action occurred.
  5094. byte      last_action_code    R/O  Type of action that occurred,
  5095.                                    e.g WR_CLOSE, WR_SIZE.
  5096. byte      last_mouse_button   R/O  Which mouse button caused the action.
  5097.  
  5098. int       scrinfo        R/O       Scroll bar percentage after a drag
  5099. char      selectx        R/O       X position of mouse when a click has
  5100.                                    been made over a window.
  5101. char      selecty        R/O  Y position of mouse when a click has
  5102.                               been made over a window.
  5103.  
  5104. The _window_spec.border[] array stores the characters
  5105. used to draw window borders, controls etc.  A number of
  5106. macros provide access to the data.
  5107.  
  5108. Macro Description
  5109.  
  5110. W_TOPLEFT      Top left border corner.
  5111. W_TOPRIGHT     Top right border corner.
  5112. W_BOTLEFT      Bottom left border corner.
  5113. W_BOTRIGHT     Bottom right border corner.
  5114. W_TOP          Top edge of border.
  5115. W_BOTTOM       Bottom edge of border.
  5116. W_LEFT         Left hand edge of border.
  5117. W_RIGHT        Right hand edge of border.
  5118. W_CTRLLEFT     The character that appears to the left of
  5119.                top edge controls.
  5120. W_CTRLRIGHT    The character that appears to the right of
  5121.                top edge controls.
  5122. W_MAX          The maximise control.
  5123. W_MIN          The minimise control.
  5124. W_CLOSE        The close control.
  5125. W_TOPL2        Top left border for a window which is not
  5126.                toppest top.
  5127. W_TOPR2        Top right border for a window which is not
  5128.                toppest top.
  5129. W_SCROLL       The scroll bar background.
  5130. W_SCRUP        Vertical scroll up arrow.
  5131. W_SCRDOWN      Vertical scroll down arrow.
  5132. W_SCRLEFT      Horizontal scroll left arrow.
  5133. W_SCRRIGHT     Horizontal scroll right arrow.
  5134. W_SCRBLIP      The scroll bar blip.
  5135.  
  5136. For example, to change the scroll bar blip to the
  5137. letter 'B', use:
  5138.  
  5139. W_SCRBLIP = 'B';
  5140.  
  5141. Or to find out what the close button is like:
  5142.  
  5143. variable = W_CLOSE;
  5144.  
  5145.  
  5146. The _window[] array stores information about individual
  5147. windows:
  5148.  
  5149. _window[].
  5150.  
  5151. char      type         R/O  Position: main, top or bottom.
  5152. char      numrows      R/O  Total size of the window in rows.
  5153. char      usetop       R/O  First usable line inside the window.
  5154. char      usebottom    R/O  Last usable line inside the window.
  5155. char      isopen       R/O  Is the window open?
  5156. char      controls     R/O  Window controls.
  5157.                                bit0  close
  5158.                                1  max
  5159.                                2  min
  5160.                                3  vscroll
  5161.                                4  hscroll
  5162.                                5  reserved
  5163.                                6  unused
  5164.                                7  unused
  5165. char      vsblip       User Character position of vertical 
  5166.                             scroll blip
  5167. char      hsblip       User Character position of horizontal
  5168.                             scroll blip
  5169. short     paper        INIT Window contents paper colour (1,0)
  5170. short     ink          INIT Window contents ink colour (7)
  5171. unsigned  blines       R/O  Number of lines in the contents
  5172.                             buffer.
  5173. unsigned  current_line R/O  The current line in the contents buffer.
  5174. char      fix_lines    R/O  The number of fixed lines at the top.
  5175. short     fix_ink      INIT Fixed lines foreground colour. (0)
  5176. short     fix_paper    INIT Fixed lines background colour. (7)
  5177. unsigned  lineo        User Line offset, i.e. start display of
  5178.                             window contents buffer on this line.
  5179. unsigned  charo        User Character offset. Start display of
  5180.                             window contents buffer at this character.
  5181. char      drawmode     INIT The window drawing mode. (WD_AUTO)
  5182. vfnptr    drawfn       INIT The window drawing function. (NOFN)
  5183.  
  5184.  
  5185.   Menu variables.
  5186.  
  5187. The _menu_spec structure stores information about the
  5188. menuing system.
  5189.  
  5190. _menu_spec.
  5191.  
  5192. unsigned  lastbuilt       R/O  The last menu built.
  5193. int       lastmenuselect  R/O  The last menu selection:
  5194.                                Menu number.
  5195. int       lastitemselect  R/O  The last menu selection:
  5196.                                Item number.
  5197. short     bar_ink         INIT Menu bar ink. (0)
  5198. short     bar_paper       INIT Menu bar paper. (7)
  5199. short     bar_hotkey      INIT Menu bar hotkey ink. (15)
  5200. short     bar_disabled    INIT Menu bar grey item ink. (8,0)
  5201. short     body_ink        INIT Menu body ink. (0)
  5202. short     body_paper      INIT Menu body paper. (7)
  5203. short     body_hotkey     INIT Menu body hotkey ink. (15)
  5204. short     body_disabled   INIT Menu body grey item ink. (8,0)
  5205. char      body_space      INIT The space between menu item text
  5206.                                and the menu border. (1)
  5207. char      body_offset     INIT The menu body is shifted to the
  5208.                                right by this number of characters. (2)
  5209. char      bar_space       INIT Space between items on menu bar. (2)
  5210. char      bar_hilite_edge INIT Overlaps of highlight past
  5211.                                the end of the text on the menu bar. (1)
  5212. char      shadow_below    INIT Size of shadow below menu. (1)
  5213. char      shadow_right    INIT Size of shadow to right of menu. (2)
  5214. char      shadow_ink      INIT Colour of ink in shadow. (8,0)
  5215. char      shadow_paper    INIT Colour of paper in shadow. (0)
  5216. char      border[14]      INIT Menu drawing characters (see notes.)
  5217. unsigned  lastpopbuilt    R/O      The last popup menu built.
  5218. int       lastpopmenuselect  R/O   The last popup menu selection:
  5219.                                    Menu number.
  5220. int       lastpopitemselect  R/O   The last popup menu selection:
  5221.                                    Item number.
  5222. char      popmenu            R/O   Set TRUE when popup menus are
  5223.                                   active.
  5224. char     pop_left         INIT  TRUE for _popmenu_at menus to appear
  5225.                                 with mouse over top left corner.
  5226.                                 FALSE for menus to appear with mouse over
  5227.                                 top right corner. (FALSE)
  5228.  
  5229. The _menu_spec.border[] array stores the characters
  5230. used to draw window borders, controls etc.  A number of
  5231. macros provide access to the data. See the examples for
  5232. _window_spec.border, above.
  5233.  
  5234. Macro Description
  5235.  
  5236. M_TOPLEFT     Top left corner of the menu box border.
  5237. M_TOPRIGHT    Top right corner of the menu box border.
  5238. M_BOTLEFT     Bottom left corner of menu box border.
  5239. M_BOTRIGHT    Bottom right corner of menu box border.
  5240. M_TOP         Top edge of menu box.
  5241. M_BOTTOM      Bottom edge of menu box.
  5242. M_LEFT        Left hand edge of menu box.
  5243. M_RIGHT       Right hand edge of menu box.
  5244. M_CROSSLEFT   Cross bar meets left hand edge.
  5245. M_CROSSRIGHT  Cross bar meets right hand edge.
  5246. M_CROSS       Horizontal cross bar.
  5247. M_BLANKGAP    White space surrounding item text.
  5248. M_CHECK       Mark placed against checked menu items.
  5249.  
  5250.  
  5251.   Dialogue box, query and flash box variables.
  5252.  
  5253. The _dbox_spec structure stores information about the
  5254. appearance of dialogue boxes.
  5255.  
  5256. _dbox_spec.
  5257.  
  5258. unsigned  active       R/O  The number of the currently active
  5259.                             dialogue.
  5260. char      border[32]   INIT Dialogue drawing characters (see notes.)
  5261. short     ink          INIT Dialogue ink colour. (0)
  5262. short     hotkey       INIT Dialogue hotkey ink colour. (15)
  5263. short     paper        INIT Dialogue paper colour. (7)
  5264. short     shadow_ink   INIT Dialogue shadow ink colour. (8,0)
  5265. short     shadow_paper INIT Dialogue shadow paper colour. (0)
  5266. short     grey         INIT Colour of greyed controls. (8,0)
  5267. char      lift         INIT Dialogues are lifted by this many
  5268.                             characters to improve appearance. (1)
  5269. float     scrollsecs   INIT Seconds to pause when scrolling
  5270.                             lists. (0.2)
  5271. float     dclick       INIT Double click time delay in seconds. (0.2)
  5272. char      shadow_right INIT Size of shadow to right of dialogue. (2)
  5273. char      shadow_below INIT Size of shadow below dialogue. (1)
  5274. char      lbox_eofield INIT Number of blank characters at
  5275.                             end of text fields in horizontal lists.
  5276. unsigned  char filter_key   ASCII code key store for text
  5277.                             control filters.
  5278. unsigned  char filter_key2  Scan code key store for text
  5279.                             control filters.
  5280. char      _ca_ret           Used for passing the return code from
  5281.                             a dialogue's controls.  Can be manipulated
  5282.                             to alter the exit mode of a control. 
  5283. short     flash_ink    INIT Ink colour for flash boxes. (0)
  5284. short     flash_paper  INIT Paper colour for flash boxes. (7)
  5285. char      flash_vgap   INIT Space above and below text lines
  5286.                             in flash boxes. (1)
  5287. char      flash_hgap   INIT         Space to left and right of text in
  5288.                                     flash boxes. (2)
  5289. char      query_button_gap     INIT Space between text & buttons
  5290.                                     in query boxes.
  5291.                                     (QB_BAR) - Indicates that a horizontal
  5292.                                     bar is used.
  5293. char      query_button_space   INIT Space between button text & chevrons. (1)
  5294. char      query_button_spacing INIT Space between adjacent chevrons. (3)
  5295. char      query_bar_gap        INIT Space above & below horizontal bar. (1)
  5296.  
  5297.  
  5298.  
  5299. There are two useful variables in the _dbctrl
  5300. structure:
  5301.  
  5302. _dbox[].control[].
  5303.  
  5304. int       iret      Integer return from control
  5305. char *    bret      Character pointer return from control
  5306.  
  5307. These are accessed as follows:
  5308.  
  5309. _dbox[number].control[control_number].iret
  5310. _dbox[number].control[control_number].bret
  5311.  
  5312. This was described in the discussion of dialogue boxes
  5313. earlier.
  5314.  
  5315. The _dbox_spec.border[] array stores the characters
  5316. used to draw dialogue boxes and controls.  A number of
  5317. macros provide access to the data.  See the examples
  5318. for _window_spec.border, above.
  5319.  
  5320. Macro Description
  5321.  
  5322. _DB_TOPLEFT   Top left hand corner of the border.
  5323. _DB_TOP       Top edge of the border.
  5324. _DB_TOPRIGHT  Top right hand corner of the border.
  5325. _DB_LEFT      Left hand edge of the border.
  5326. _DB_PAGE      White space, dialogue background.
  5327. _DB_RIGHT     Right hand edge of border.
  5328. _DB_BOTLEFT   Bottom left hand corner of border.
  5329. _DB_BOT       Bottom edge of border.
  5330. _DB_BOTRIGHT  Bottom right hand corner of border.
  5331. _DB_BUTTONL   Left hand 'chevron' on a button.
  5332. _DB_BUTTONR   Right hand 'chevron' on a button.
  5333. _DB_CHECKL    Left hand 'bracket' on a check box.
  5334. _DB_CHECK     Check mark for a check box.
  5335. _DB_UNCHECK   Shown in a check box that is not checked.
  5336. _DB_CHECKR    Right hand 'bracket' on a check box.
  5337. _DB_RADIOL    Left hand 'bracket' on a radio button.
  5338. _DB_RADIO     Shown in the radio button that is selected.
  5339. _DB_RADIOR    Right hand 'bracket' on a radio button.
  5340. _DB_TEXTL     Left hand 'bracket' on a text box.
  5341. _DB_TEXT      Unused space in text box.
  5342. _DB_TEXTR     Right hand 'bracket' on text box.
  5343. _DB_SCROLL    Scroll bar background.
  5344. _DB_LSCROLL   Left arrow on horizontal scroll bar.
  5345. _DB_RSCROLL   Right arrow on horizontal scroll bar.
  5346. _DB_USCROLL   Up arrow on vertical scroll bar.
  5347. _DB_DSCROLL   Down arrow on vertical scroll bar.
  5348. _DB_SCRBLIP   Scroll bar blip.
  5349. _DB_BARL      Horizontal bar meets left border.
  5350. _DB_BAR       Horizontal bar.
  5351. _DB_BARR      Horizontal bar meets right border.
  5352. _DB_COMBO     Combo box open button.
  5353.  
  5354.  
  5355.   Speed bar variables.
  5356.  
  5357. The structure _speed_spec contains information on the
  5358. speed bar.
  5359.  
  5360. _speed_spec.
  5361. short     paper          INIT Speed bar paper colour. (7)
  5362. short     ink            INIT Speed bar ink colour. (0)
  5363. char      textindent     INIT Speed bar text indent at left edge. (1)
  5364. char      isdef          R/O  Set to TRUE when default text is shown.
  5365. char      maxlen         INIT Display no more that this number of
  5366.                               chars. (80)
  5367. char      border[4]      INIT Button drawing characters. (See notes.)
  5368. char      button_indent  INIT Position of first button. (1)
  5369. char      button_space   INIT Position between text and chevron. (0)
  5370. char      button_spacing INIT Space between buttons on bar. (1)
  5371.  
  5372. The _speed_spec.border[] array stores the characters
  5373. used to draw speed bar buttons.  A number of macros
  5374. provide access to the data. See the examples for
  5375. _window_spec.border, above.
  5376.  
  5377. Macro Description
  5378.  
  5379. _SB_BUTTONL    Left hand edge of a speed bar button.
  5380. _SB_SPACE      Space between edge of button and text.
  5381. _SB_BUTTONR    Right hand edge of a speed bar button.
  5382.  
  5383.  
  5384.   Tool bar variables.
  5385.  
  5386. The structure _tool_spec holds information about the
  5387. toolbars.
  5388.  
  5389. _tool_spec.
  5390. short     paper        INIT Paper colour for the toolbar. (7,4)
  5391. short     ink          INIT Ink colour for text and controls. (0,7)
  5392. short     grey         INIT Colour of greyed controls. (0)
  5393. char      nlines       R/O  The number of toolbar lines used.
  5394. char      textindent   INIT Indent of text lines on
  5395.                             toolbar. (2)
  5396.  
  5397. There is a useful variable in the _tb_control
  5398. structure:
  5399.  
  5400. _tb_control[].
  5401. int       iret         Integer return from a toolbar control.
  5402.  
  5403. This variable stores the state of a toggle button
  5404. control, or the selected item in a combo box control.
  5405. It is accessed as follows:
  5406.  
  5407. _tb_control[control_number].iret
  5408.  
  5409. as described in the discussion of toolbar controls.
  5410.  
  5411.  
  5412.   Graphics mode variables.
  5413.  
  5414. The structure __gminfo holds information about the
  5415. graphics screen mode.  Note the double leading
  5416. underscore in the name.
  5417.  
  5418. __gminfo.
  5419.  
  5420. char _far *  font_table   R/O  A pointer to the font used
  5421.                                for text display.
  5422. char *       vbuf         R/O  A pointer to the video display mimic.
  5423.                                This is an area of memory arranged
  5424.                                in the same way as text mode video
  5425.                                memory.  It should not be written to,
  5426.                                and this will have no effect on the 
  5427.                                display.  It may be read to determine 
  5428.                                the character at a certain position
  5429.                                on the screen.
  5430. unsigned     gx           R/O  Screen width in pixels.
  5431. unsigned     gy           R/O  Screen height in pixels.
  5432. char         xchar        R/O  Character box width in pixels.
  5433. char         ychar        R/O  Character box height in pixels.
  5434.  
  5435. Structures of type _window_pix are returned by the
  5436. _window_gsize function to describe the size and
  5437. position of windows when in graphics screen modes.
  5438.  
  5439.  
  5440. unsigned    xorigin       R/O  The absolute x position of the top
  5441.                                left corner of the window measured from
  5442.                                the left of the screen.
  5443. unsigned    yorigin       R/O  The absolute y position of the top
  5444.                                left corner of the window measured from
  5445.                                the top of the screen.
  5446. unsigned    xsize         R/O  The width of the window in pixels.
  5447. unsigned    ysize         R/O  The height of the window in pixels.
  5448.  
  5449. The _pix_to_save structure is used for communication
  5450. between the Steph system and the screen save and
  5451. restore functions.
  5452.  
  5453. _pix_to_save.
  5454.  
  5455. unsigned     x1            R/O  X co-ordinate in pixels of top left
  5456.                                 corner of area to be saved.
  5457. unsigned     y1            R/O  Y co-ordinate in pixels of top left
  5458.                                 corner of area to be saved.
  5459. unsigned     x2            R/O  X co-ordinate in pixels of bottom right
  5460.                                 corner of area to be saved.
  5461. unsigned     y2            R/O  Y co-ordinate in pixels of bottom right
  5462.                                 corner of area to be saved.
  5463. char _huge * data               Pointer to the data block into which
  5464.                                 screen data has been saved or from which
  5465.                                 it must be restored.
  5466.  
  5467.  
  5468.